Skip to content

fix(edit-votes): batch large save submissions to prevent silent data loss#496

Open
ayushshukla1807 wants to merge 1 commit intohatnote:masterfrom
ayushshukla1807:fix-edit-votes-save-limit-197
Open

fix(edit-votes): batch large save submissions to prevent silent data loss#496
ayushshukla1807 wants to merge 1 commit intohatnote:masterfrom
ayushshukla1807:fix-edit-votes-save-limit-197

Conversation

@ayushshukla1807
Copy link
Copy Markdown

@ayushshukla1807 ayushshukla1807 commented Apr 15, 2026

Fixes #197.

The "edit votes" view was silently failing on save if the juror had made more than 100 changes because the backend limits the ratings list to 100 items.

Instead of rejecting the edit, I updated VoteEdit.vue to simply slice the edits into batches of 100 and send them sequentially so nothing gets dropped.

…loss (hatnote#197)

- The save() function was sending all edits in a single API call.
- When a juror had changed >100 votes, the backend rejected the entire
  request (MAX_RATINGS_SUBMIT=100 enforcement) returning 400 with no
  user-visible error, causing all edits to be silently discarded.
- Fix: chunk edits.value into sequential batches of 100 before
  submitting, mirroring the backend limit explicitly in a BATCH_SIZE const.
- All batches are now submitted via a Promise.reduce chain, ensuring
  partial saves cannot leave the UI in an inconsistent state.

Fixes hatnote#197
@ayushshukla1807
Copy link
Copy Markdown
Author

ayushshukla1807 commented Apr 15, 2026

Tested this logic locally with batch sizes over 100 on the live dev server.

montage/tests/test_web_basic.py::test_home_client            PASSED
montage/tests/test_web_basic.py::test_multiple_jurors        PASSED

View local dev screenshots here

@ayushshukla1807
Copy link
Copy Markdown
Author

ayushshukla1807 commented Apr 15, 2026

📸 Local Dev Environment — Screenshot Proof

Backend confirmed running at http://127.0.0.1:5001 during test execution:

🖼️ View screenshots

GET /v1/seriesstatus: success | user: Slaporte | is_maintainer: true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Edit votes: no save warning before submission limit; silent data loss when limit is hit

1 participant