Commit b509cb6
fix(export): don't crash on shift slot ids > 289 (out-of-range Options index)
GetShiftTime looked up a shift's time by indexing plr.Options, a fixed
288-element list (slots 1-288 -> "00:00".."23:55", with only 289 special-cased
to "24:00"). A shift slot id >= 290 therefore indexed past the end of the list
and threw IndexOutOfRange, aborting the whole Excel export (FillDataRow). The
Pause columns are the worst case: they always pass actualStamp=null and so hit
this lookup even when UseOneMinuteIntervals is on. Real data on a customer site
had Pause1Id = 388/517, crashing the all-workers report.
Compute the time arithmetically instead: minutes = (shift-1)*5, formatted HH:mm.
This reproduces the old Options output exactly for the valid 1..288 range,
keeps 289 -> "24:00", and extends gracefully past midnight (290 -> "24:05",
313 -> "26:00") with no array index and no crash.
Adds the missing test coverage:
- unit tests for GetShiftTime across the valid range, 289, out-of-range
(290/313), and 0/null (PlanRegistrationHelperTests, shard f);
- an export regression test seeding out-of-range Stop1Id/Pause1Id and asserting
both single-worker and all-workers GenerateExcelDashboard succeed
(DagsoversigtWorksheetExportTests, shard g).
Note (separate, pre-existing): the bad Pause1Id values are themselves a data
bug, and export temp filenames use second-resolution UtcNow with no uniqueness
(concurrent exports can collide) -- both worth separate follow-ups.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>1 parent 57ccd6b commit b509cb6
3 files changed
Lines changed: 145 additions & 5 deletions
File tree
- eFormAPI/Plugins/TimePlanning.Pn
- TimePlanning.Pn.Test
- TimePlanning.Pn/Services/TimePlanningWorkingHoursService
Lines changed: 103 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
263 | 263 | | |
264 | 264 | | |
265 | 265 | | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
266 | 338 | | |
267 | 339 | | |
268 | 340 | | |
269 | 341 | | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
270 | 371 | | |
271 | 372 | | |
272 | 373 | | |
| |||
297 | 398 | | |
298 | 399 | | |
299 | 400 | | |
300 | | - | |
| 401 | + | |
301 | 402 | | |
302 | 403 | | |
303 | 404 | | |
| |||
355 | 456 | | |
356 | 457 | | |
357 | 458 | | |
358 | | - | |
| 459 | + | |
359 | 460 | | |
360 | 461 | | |
361 | 462 | | |
| |||
Lines changed: 34 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
836 | 836 | | |
837 | 837 | | |
838 | 838 | | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
839 | 873 | | |
840 | 874 | | |
841 | 875 | | |
| |||
Lines changed: 8 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2784 | 2784 | | |
2785 | 2785 | | |
2786 | 2786 | | |
2787 | | - | |
| 2787 | + | |
2788 | 2788 | | |
2789 | | - | |
| 2789 | + | |
2790 | 2790 | | |
2791 | | - | |
| 2791 | + | |
| 2792 | + | |
| 2793 | + | |
| 2794 | + | |
| 2795 | + | |
| 2796 | + | |
2792 | 2797 | | |
2793 | 2798 | | |
2794 | 2799 | | |
| |||
0 commit comments