History list card: key name and a short follow-up status (section 32.2 point 14)
This commit is contained in:
1 parent
70b615758b
commit
89c5fe7af4
1 file changed
+14
-3
+14
-3
@@ -187,12 +187,23 @@ function renderDetail(record) {
|
|||||||
detailSection.hidden = false;
|
detailSection.hidden = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function keyNumbersText(check) {
|
function keyNamesText(check) {
|
||||||
|
// The card names the key by its number and the name it has now, which the
|
||||||
|
// settings may change (sections 25.2 and 32.2 point 14).
|
||||||
const numbers = check.key_numbers || [];
|
const numbers = check.key_numbers || [];
|
||||||
|
const names = check.key_names || [];
|
||||||
if (!numbers.length) {
|
if (!numbers.length) {
|
||||||
return "Key not recorded";
|
return "Key not recorded";
|
||||||
}
|
}
|
||||||
return numbers.map((number) => `Key ${number}`).join(", ");
|
return numbers
|
||||||
|
.map((number, index) => `Key ${number}: ${names[index] || "—"}`)
|
||||||
|
.join(", ");
|
||||||
|
}
|
||||||
|
|
||||||
|
function followUpText(check) {
|
||||||
|
// The summary reports whether the check raised anything to follow up, so the
|
||||||
|
// card says so in one word (section 32.2 point 14).
|
||||||
|
return check.needs_follow_up ? "Needs follow-up" : "All OK";
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderList(checks) {
|
function renderList(checks) {
|
||||||
@@ -215,7 +226,7 @@ function renderList(checks) {
|
|||||||
const heading = document.createElement("h3");
|
const heading = document.createElement("h3");
|
||||||
heading.textContent = check.checked_at;
|
heading.textContent = check.checked_at;
|
||||||
const meta = document.createElement("p");
|
const meta = document.createElement("p");
|
||||||
meta.textContent = `${keyNumbersText(check)} · Next check due ${check.next_check_due} · Software ${check.software_compatibility_status}`;
|
meta.textContent = `${keyNamesText(check)} · ${followUpText(check)}`;
|
||||||
text.append(heading, meta);
|
text.append(heading, meta);
|
||||||
|
|
||||||
const link = document.createElement("a");
|
const link = document.createElement("a");
|
||||||
|
|||||||
Reference in new issue
Block a user