Headcount FTE max decimals (#2318)¶
Problem¶
In the Headcount module, the member and student FTE fields accepted values
with up to 16 decimal places, when the product intent is one decimal place
(e.g. 0.5).
What shipped¶
PR #2329, "feat: add maxDecimals validation and support (#2318)", merged
2026-08-25 (d49b3919f).
frontend/src/constant/moduleConfig.ts— new optionalmaxDecimals?: numberon the field config type.frontend/src/constant/module-config/headcount.ts—maxDecimals: 1on both thememberandstudentFTE field configs.frontend/src/components/organisms/module/ModuleForm.vue— validation branch: rejects a typed value whose fractional part exceedsmaxDecimals, via$t('validation_max_decimals', { count: i.maxDecimals }).frontend/src/components/organisms/module/ModuleTable.vue— same check threaded into inline table editing: a Quasar inputrulesentry plus the same decimal-length check in the numeric parser used when committing a cell edit.frontend/src/i18n/common.ts— newvalidation_max_decimalskey (EN/FR).
maxDecimals is a generic field option, not Headcount-specific, so any
future module field can opt in the same way.
Since shipped¶
Two later, separately-tracked fixes reshaped this code without changing its behavior:
- Refs #2473 —
ModuleTable.vue'sgetNumericRules()(theq-inputrules builder formin/max/maxDecimals) was extracted tofrontend/src/utils/numeric-rules.tsso it's unit-testable without mounting the component;frontend/tests/unit/numeric-rules.spec.tsnow covers themaxDecimalscase, which had no test at original ship time. - Refs #2472 —
validation_max_decimalswas hard-coded singular ("decimal place") despite being parameterized; rewritten as a vue-i18n plural-pipe message ({count} decimal place | {count} decimal places), and the interpolation param renamedmax→countat all three call sites.
Follow-up: #2464 mirrors the one-decimal cap server-side (DTO validators and the HR import path).