Skip to content

fix: exclude current year-end weekly period [DHIS2-21585]#95

Draft
eirikhaugstulen wants to merge 2 commits into
mainfrom
eh/fix-weekly-adjacent-year-end
Draft

fix: exclude current year-end weekly period [DHIS2-21585]#95
eirikhaugstulen wants to merge 2 commits into
mainfrom
eh/fix-weekly-adjacent-year-end

Conversation

@eirikhaugstulen

Copy link
Copy Markdown

Summary

Fixes DHIS2-21585 by preventing getAdjacentFixedPeriods from returning the current weekly period when stepping backwards from the final week of a year.

Root Cause

The weekly backward traversal searched for the first period with a start date after the current period. When the current period was the last generated week in the year, no later start date existed, so the slice boundary fell at the end of the year and included the current period again.

Changes

  • Treat the first current-or-following weekly period as the exclusive end boundary when collecting previous periods.
  • Normalize the following-period boundary when no later period exists in the current generated year.
  • Add a Gregorian regression test for stepping back from 2023W52 to 2023W51.

Validation

  • yarn test get-adjacent-fixed-periods.gregorian.spec.ts --watchAll=false --runInBand --watchman=false
  • yarn test get-adjacent-fixed-periods --watchAll=false --runInBand --watchman=false
  • yarn test --watchAll=false --runInBand --watchman=false
  • yarn build:types
  • yarn d2-style check changed files

@sonarqubecloud

Copy link
Copy Markdown

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.89%. Comparing base (d202f08) to head (3099975).

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #95      +/-   ##
==========================================
+ Coverage   90.87%   90.89%   +0.02%     
==========================================
  Files          57       57              
  Lines        1249     1252       +3     
  Branches      352      353       +1     
==========================================
+ Hits         1135     1138       +3     
  Misses        112      112              
  Partials        2        2              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

2 participants