date-field range (#2075).
#3319 already sums a number-type custom field flagged
showSumAtTopOfList=true across a list's (optionally swimlane-scoped)
cards and shows it as a "∑ N" badge. #2075 asked for a broader list-level
summary: min/max for a number field, a range for a date field, and how
many cards have the field set at all. This extends that SAME mechanism -
the same per-field checkbox, the same badge area - rather than adding a
second configuration surface:
- models/lib/customFieldsSum.js gains numberFieldStats() (sum/min/max/
count-of-total, reusing the exact numeric-parsing rules of the existing
sumCustomFieldValues()) and dateFieldRange() (earliest/latest among the
cards, same count/total). Neither touches sumCustomFieldValues() itself.
- client/components/lists/listHeader.js's numberFieldsSum()/
hasNumberFieldsSum() now share their field/card lookup with the new
numberFieldsSumTooltip() (adds "(min–max, N/total)" to the sum badge's
tooltip, wordless so it needs no new i18n key) and the new
hasDateFieldsRange()/dateFieldsRangeLabel()/dateFieldsRangeTooltip() for
a date-type field flagged the same way - shown as an earliest–latest
badge instead of a sum, since summing dates has no meaning.
- listHeader.jade adds the date-range badge next to the existing sum
badge (both mini-screen and full layouts), and points the sum badge's
title at the new tooltip helper.
- One new i18n key, "date-range-of-fields", mirroring the existing
"sum-of-number-fields" tooltip label; min/max/count are numeric-only so
they need no new translatable words. Added to en.i18n.json and to all
245 other locale files - a direct translation for the ~65 base
languages covered by a curated dictionary (reused across their locale
variants), an English placeholder for the remainder per the
no-translation-anywhere-yet policy, to be filled the normal way via
releases/translations/fill-translations.mjs.
- tests/customFieldsSum.test.cjs: a #3319 regression test proving
sumCustomFieldValues()'s own result is untouched, plus coverage for
numberFieldStats() (sum/min/max, several flagged fields combined,
card-count-with-value, non-numeric values ignored, empty input) and
dateFieldRange() (earliest/latest, Date and ISO-string values, count,
an unparseable value ignored rather than corrupting the range, empty
input). node tests/customFieldsSum.test.cjs: 21/21 passed.
Thanks to rlach and xet7 !
Closes#2075,