Skip to content

Commit 594c9a2

Browse files
fix: Czech DCOUNT translation and boolean field coercion
Addresses Cursor Bugbot findings on PR #1652: - csCZ.ts: DCOUNT was English 'DCOUNT' instead of localized 'DPOCET' (consistent with DCOUNTA = 'DPOCET2') - resolveFieldIndex: coerce boolean field arg to number (TRUE -> 1, FALSE -> 0) per Excel convention, matching ArithmeticHelper semantics Regression test added in hyperformula-tests. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent f7d91fc commit 594c9a2

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

src/i18n/languages/csCZ.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ const dictionary: RawTranslationPackage = {
7676
DAYS: 'DAYS',
7777
DB: 'ODPIS.ZRYCH',
7878
DAVERAGE: 'DPRUMER',
79-
DCOUNT: 'DCOUNT',
79+
DCOUNT: 'DPOCET',
8080
DCOUNTA: 'DPOCET2',
8181
DGET: 'DZISKAT',
8282
DMAX: 'DMAX',

src/interpreter/plugin/DatabasePlugin.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,7 @@ export class DatabasePlugin extends FunctionPlugin implements FunctionPluginType
413413
*
414414
* @param database - The database range (first row = headers).
415415
* @param field - A string (header name, case-insensitive) or number (1-based column index).
416+
* Booleans are coerced to numbers (TRUE → 1, FALSE → 0) per Excel convention.
416417
* @returns 0-based column index, or CellError if field is invalid.
417418
*/
418419
private resolveFieldIndex(database: SimpleRangeValue, field: RawScalarValue): number | CellError {
@@ -429,8 +430,10 @@ export class DatabasePlugin extends FunctionPlugin implements FunctionPluginType
429430
return new CellError(ErrorType.VALUE, ErrorMessage.WrongType)
430431
}
431432

432-
if (isExtendedNumber(field)) {
433-
const index = Math.trunc(getRawValue(field))
433+
const numericField = typeof field === 'boolean' ? Number(field) : field
434+
435+
if (isExtendedNumber(numericField)) {
436+
const index = Math.trunc(getRawValue(numericField))
434437
if (index < 1 || index > headers.length) {
435438
return new CellError(ErrorType.VALUE, ErrorMessage.WrongType)
436439
}

0 commit comments

Comments
 (0)