Skip to content

fix(number): round values read with zero decimals - #3401

Open
whoalin1 wants to merge 1 commit into
nextcloud:mainfrom
whoalin1:devin/1795951200-number-zero-decimals
Open

whoalin1 wants to merge 1 commit into
nextcloud:mainfrom
whoalin1:devin/1795951200-number-zero-decimals

Conversation

@whoalin1

Copy link
Copy Markdown

Summary

Resolves #3364.

Number cells keep their stored fractional values, but reading them through a zero-decimal column truncated fractions (2.7 became 2) and saturated very large values at PHP_INT_MAX. Zero-decimal values are now rounded consistently with other precision settings; ordinary integer-range values still read as integers, while out-of-range values remain floats instead of being clamped.

Validation

  • Focused PHPUnit passed: RowCellNumberMapperTest, 15 tests / 15 assertions, using a minimal local bootstrap because the repository bootstrap expects placement inside a full Nextcloud server checkout
  • PHP syntax checks passed for both changed files
  • php-cs-fixer dry-run passed for both changed files
  • Psalm reported no errors for lib/Db/RowCellNumberMapper.php

Not run: live Nextcloud UI/API validation.

AI disclosure

Implemented and validated with Devin assistance; the contributor reviewed and submits this pull request.

@enjeck enjeck left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please show proof this works in a nextcloud setup

@whoalin1

Copy link
Copy Markdown
Author

Validated in a live Nextcloud setup using the Tables Playwright Docker environment (Nextcloud 34.0.6, Tables 3.0.0-dev.0 mounted from this branch).

Through the API I created a zero-decimal number column and inserted 2.7, 0.4, -2.7, and 1.999. Reading the rows back from GET /index.php/apps/tables/api/1/tables/2/rows returned 3, 0, -3, and 2 respectively, confirming that the values are rounded rather than truncated while the write path still accepts the fractional input.

@enjeck

enjeck commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Validated in a live Nextcloud setup using the Tables Playwright Docker environment (Nextcloud 34.0.6, Tables 3.0.0-dev.0 mounted from this branch).

Through the API I created a zero-decimal number column and inserted 2.7, 0.4, -2.7, and 1.999. Reading the rows back from GET /index.php/apps/tables/api/1/tables/2/rows returned 3, 0, -3, and 2 respectively, confirming that the values are rounded rather than truncated while the write path still accepts the fractional input.

Any chance you can share a video? Of actually running the flow that works, not just running the tests Sorry I'm asking for so much proof, but since you're a new contributor, I need to be sure a human actually tested this out and it works, and it's not all automated

Number cells keep their stored fractional value, but reading through a zero-decimal column truncated the fraction and saturated very large values at the integer maximum. Rounding consistently with other decimal precision preserves normal integer output while avoiding both forms of data distortion.

Assisted-by: Devin:adaptive

Signed-off-by: Man Alin <whoalin414@gmail.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Number columns with 0 decimals cut off fractions when reading (2.7 is shown as 2)

3 participants