Repository navigation
fix(scheduling): generar respetando días fijos y solicitudes, y mes publicado de solo lectura - #19
Merged
bpstack merged 7 commits intoOct 12, 2026
Conversation
…ating - generated-rows.ts: builds the rows to insert from the solver matrix and the locked cells, skipping only those stored with source_constraint_id. - schedule-generate.controller.ts: uses it; the locked cells that live only in lockedCells (fixed days, approved requests) are inserted with their locked value. - generated-rows.test.ts: covers both kinds of locked cell and the virtual days of the previous month. Why: generation skipped every locked cell when inserting, while the delete before it only spares the stored ones, so fixed-day and approved-request cells ended empty. Checked against the local database: the two fixed-days employees had 0 cells in the four solver-generated months; regenerating October 2026 gives each 31 (P on weekdays, L at weekends), also in the grid.
- scheduling-controller.ts: refusePublished answers 409 when the month is published; editing a cell or a day (one or in bulk) and creating, editing, approving or deleting a constraint use it. PUT /months/:id no longer goes back to draft: that is what unpublish is for. Notes can still be edited. - published-month.test.ts: the nine paths answer 409 and write nothing. Why: none of these paths looked at the month status, so a published roster could change under the staff reading it. Checked with curl against the local database: on a published month a cell edit and PUT back to draft answer 409; after unpublish the same edit answers 200.
- scheduling-repository.ts: setSchedulableEmployees removes only the employees left out and adds only the new ones, in one transaction; the rows that stay keep start_date, end_date, display_order and added_by. An unknown id still fails instead of being ignored. - schedulable-employees.test.ts: the queries it runs, the empty list and the rollback. Why: it cleared scheduling_employees and filled it again, so every save lost the start and end dates and the manual order. Checked with curl against the local database: a start date set on an employee survives saving the same list.
- decisions.md: 2026-10-11 entry with the measurements (current, seed, one thread, interleave_search) on the local month and the 30x31 benchmark, the decision and how to revisit it. Why: the owner chose generation speed over reproducibility; the TODO entry asked to decide it.
… in one transaction - Bulk edits of cells and days answer 400 when a day id is not a day of the month in the URL (countDaysInMonth). - bulkUpsertAssignments reads the locked cells FOR UPDATE and writes the edit in one transaction; a locked cell still answers 409 and now nothing is written. - resetMonthAssignments corrects the dates, deletes the cells and inserts the new grid in one transaction. - fixMonthDates, deleteAllAssignmentsByMonth and upsertAssignment go: they had no other user. - services/scheduling/AGENTS.md: both rules and the real bulk endpoint. - month-scope.test.ts: foreign days, the locked cell and the reset. Why: PUT /months/141/assignments with a day of month 140 rewrote that cell through uk_day_employee, so a published month could be edited from any draft month; and a reset that failed after the delete left the month empty. Checked against the local database: the cross-month edit changed October from November before and answers 400 now, a locked cell answers 409 with nothing written, a reset whose insert fails keeps its 280 cells, and editing a cell from the grid in the browser still saves.
…solver - decisions.md: LI does not count towards the weekly free days nor the monthly minimum of L, and it stays that way. Why: decided by the owner on 2026-10-12; it matches the catalogue, which describes LI as an extra free day, and keeps every hard rule unchanged.
- decisions.md: the 30-minute startup limit and the unbounded queue are kept, with the reasons and what to change if it is revisited. Why: decided by the owner on 2026-10-12; only admins generate, the demo is rate limited and the daemon starts in seconds.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cambios
docs/scheduling/decisions.md: el solver sigue sin ser determinista,LIfuera de las reglas de descanso y la cola del daemon se quedan como están.Por qué
Los meses generados dejaban vacías celdas fijadas, y se podía editar un mes publicado desde uno en borrador.