Improve multi month polls

This commit is contained in:
2026-06-10 18:03:13 +02:00
parent 1e414b564d
commit c547cf2389
4 changed files with 130 additions and 9 deletions
+12 -1
View File
@@ -49,6 +49,14 @@ function renderAll() {
cal = new Calendar($("calendar"), {
canClick: (ds) => canVote && byDate.has(ds),
isOffered: (ds) => byDate.has(ds),
months: () => {
const counts = new Map();
for (const ds of byDate.keys()) {
const key = ds.slice(0, 7);
counts.set(key, (counts.get(key) || 0) + 1);
}
return counts;
},
isPicked: (ds) => byDate.has(ds) && myPicks.has(byDate.get(ds).id),
onToggle: (ds) => {
const id = byDate.get(ds).id;
@@ -85,8 +93,11 @@ function renderAll() {
function updateSummary() {
const n = myPicks.size;
const total = poll.options.length;
$("vote-summary").textContent =
n === 0 ? "No days circled yet." : n === 1 ? "1 day circled." : `${n} days circled.`;
n === 0
? `No days circled yet — ${total} ${total === 1 ? "day" : "days"} offered.`
: `${n} of ${total} offered days circled.`;
}
function renderResults() {