fix(excel-export): restore Normal/Sunday/Saturday hour columns in all-workers total sheet#1584
Merged
Merged
Conversation
…-workers total sheet Commit ce4e33f replaced the hardcoded Normal_Hours / Hours_Sunday / Hours_Saturday columns in the Total sheet with dynamic pay-code columns, but those three columns should have been kept alongside the new dynamic columns — not removed. Restores in TimePlanningWorkingHoursService.GenerateAllWorkersExcelDashboard: - Normal_Hours / Hours_Sunday header columns after SumFlexStart - Hours_Saturday header column after Message - Per-worker totalRow now computes and writes: * sumHoursSundayAndHoliday (Sunday + holiday hours, Grundlovsdag only after 12:00) * normalHours = siteTotalNettoHours - sumHoursSundayAndHoliday * sumHoursSaturday = Saturday NettoHours sum - Dynamic per-pay-code columns continue to be appended afterwards (unchanged). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Restores the fixed hour-bucket columns (Normal / Sunday+Holiday / Saturday) in the “Total” sheet of the all-workers Excel export while keeping the dynamic per-pay-code columns introduced previously.
Changes:
- Reintroduced
Normal_Hours,Hours_Sunday, andHours_Saturdayheaders in the Total sheet. - Added per-worker computations for normal hours, Sunday/holiday hours (with Grundlovsdag counting only after 12:00), and Saturday hours, and appended them to the Total row output.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+3324
to
+3338
| // Sunday + holiday hours (Grundlovsdag only counts hours after 12:00) | ||
| var sumHoursSundayAndHoliday = 0.0; | ||
| foreach (var day in timePlannings) | ||
| { | ||
| var isSundayOrHoliday = day.IsSunday || PlanRegistrationHelper.IsOfficialHoliday(day.Date); | ||
| if (!isSundayOrHoliday) continue; | ||
|
|
||
| sumHoursSundayAndHoliday += PlanRegistrationHelper.IsGrundlovsdag(day.Date) | ||
| ? CalculateHoursAfterNoon(day) | ||
| : day.NettoHours; | ||
| } | ||
| var normalHours = siteTotalNettoHours - sumHoursSundayAndHoliday; | ||
| var sumHoursSaturday = timePlannings.Where(x => x.IsSaturday).Sum(x => x.NettoHours); | ||
|
|
||
| totalRow.Append(CreateNumericCell(normalHours)); |
…uage GenerateExcelDashboard(all-workers) never set Thread.CurrentUICulture (unlike the single-worker version at line ~2375), so Translations.X static properties — which resolve via ResourceManager + CurrentUICulture — fell back to the default culture (English) for the entire request. The downstream `localizationService.GetString(Translations.X)` chain then could not recover Danish headers for resx keys whose name differs from the English value (PlanHours, NettoHours, SumFlexStart, Hours_Sunday, etc.). Loads the user's language at the top of the function and assigns CurrentUICulture to it (mirroring the single-worker path); removes the now-redundant later language load. No resx changes needed — all keys already have Danish translations. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Some customer DBs have stale Message rows where translations diverged from the canonical seed values. The clearest example reported in the field is id=11 VacationDayOff stored as DaName='Ferie fridag' / DeName='Ferie fridag Tag' / EnName='Vacation day off' instead of the correct Afspadsering / Freizeit / Time off. The existing seed only INSERTed missing rows by Name and never UPDATEd divergent ones, so once a customer DB had a wrong row it stayed wrong. This adds a self-heal pass that, on every plugin startup, updates each Message row whose DaName, EnName, or DeName differs from the corresponding entry in TimePlanningSeedMessages. The seed file is the source of truth for these system messages; mirrors the existing permissions update pattern in the same file (lines 79-89). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
Normal_Hours/Hours_Sunday/Hours_Saturdaycolumns in the all-workers Excel Total sheet with the new dynamic pay-code columns, but those three columns should have been kept alongside the new ones — not removed.GenerateAllWorkersExcelDashboardand recomputes the per-workernormalHours,sumHoursSundayAndHoliday(Grundlovsdag only counts after 12:00), andsumHoursSaturdayagainst the cachedtimePlanningsso the totalRow matches the headers.ce4e33faare preserved and continue to be appended after the restored fixed columns.Test plan
dotnet build TimePlanning.Pn.csproj) — verified clean locally (0 errors)/working-hours/reports/file-all-workersexport and confirm the Total sheet shows the three restored columns populated with the expected valuesPayRuleSetstill render after the restored columns🤖 Generated with Claude Code