Skip to content

Fix week() calculation to start week 1 at days 1–7#7274

Closed
venom1204 wants to merge 13 commits intomasterfrom
issue____2611
Closed

Fix week() calculation to start week 1 at days 1–7#7274
venom1204 wants to merge 13 commits intomasterfrom
issue____2611

Conversation

@venom1204
Copy link
Contributor

closes #2611

This PR fixes the long-standing bug in week() (#2611) by defining weeks sequentially: days 1–7 are week 1, days 8–14 week 2, etc.

hi @MichaelChirico @tdhock can you please have a review when you got time .
thanks.

@codecov
Copy link

codecov bot commented Aug 31, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.12%. Comparing base (08ea530) to head (3e8b9b7).
⚠️ Report is 8 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7274      +/-   ##
==========================================
+ Coverage   99.10%   99.12%   +0.02%     
==========================================
  Files          84       85       +1     
  Lines       16128    16648     +520     
==========================================
+ Hits        15983    16503     +520     
  Misses        145      145              

☔ 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.

@github-actions
Copy link

github-actions bot commented Aug 31, 2025

  • HEAD=issue____2611 slower P<0.001 for memrecycle regression fixed in #5463
  • HEAD=issue____2611 slower P<0.001 for isoweek improved in #7144
    Comparison Plot

Generated via commit 3e8b9b7

Download link for the artifact containing the test results: ↓ atime-results.zip

Task Duration
R setup and installing dependencies 3 minutes and 12 seconds
Installing different package versions 22 seconds
Running and plotting the test cases 2 minutes and 36 seconds

Copy link
Member

@tdhock tdhock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@tdhock tdhock changed the title Fix week() calculation to start week 1 at days 1–7 (resolves #2611) Fix week() calculation to start week 1 at days 1–7 Sep 2, 2025
@tdhock
Copy link
Member

tdhock commented Sep 25, 2025

@venom1204 please resolve conflicts

@MichaelChirico can you please review because you posted the issue this fixes?

@venom1204
Copy link
Contributor Author

@tdhock done

@venom1204 venom1204 requested a review from tdhock September 26, 2025 11:13
@jangorecki
Copy link
Member

jangorecki commented Oct 3, 2025

Doesn't LGTM because it is a breaking change, not even documented. Maybe we can detect breaking behavior and raise warning that can be suppressed with a temporary global option?

jangorecki and others added 7 commits October 3, 2025 23:00
* rolling median

* keep lint-c happy

* try skip lint here

* codecov

* Apply wording suggestions from @mcol code review

Co-authored-by: Marco Colombo <m.colombo@ed.ac.uk>

* solve unreached codecov lines by raising warning

* Revert "solve unreached codecov lines by raising warning"

This reverts commit 34af12e.

* codecov edge cases not reached before

---------

Co-authored-by: Marco Colombo <m.colombo@ed.ac.uk>
* zeros and num stability

* frollprod adaptive fast redirect to exact

* more tests

* codecov

* correct expected ans

* Revert "zeros and num stability"

This reverts commit 4074e12.

* handle zeros in frollprod fast
* pointer type changes + replace if with switch

* Update src/reorder.c

---------

Co-authored-by: Benjamin Schwendinger <52290390+ben-schwen@users.noreply.github.com>
* Changed many function calls to use read only variants when appropriate

* implemented improvements as requested

* minor update
* frollvar and frollsd

* export

* news entry for var and sd

* codecov fix

* handle var < 0 spotted by Ben

* elaborate more on fall back to slow when NAs are in the input

* align to changes proposed in #7376

* reuse existing macro as per Ben suggestion
@ben-schwen
Copy link
Member

@venom1204 Can you please add this breaking and raise the warning when mixed weeks arise? E.g. calculate both weeks (old + new formula) and warn when there is a mismatch?

ben-schwen and others added 2 commits October 20, 2025 10:20
* implement comment.char argument for fread

* remove handling of comment.char=NULL

* update NEWS

* update tests

* change wording for error

* remove unreachable code

* add helper function

* extend tests

* update tests

* use skip_line helper

* add comments for helpers

* fix test numbering

* add more tests

* simplify read

* Revert "simplify read"

This reverts commit a0a9525.

* separate helpers

* add comments

* add coverage

* simplify header handling

* increase coverage

* simplify code

* control skipping white spaces before comments with strip.white

* tighten helper

* try improving readability with blank lines

* include some line-end comments in the multi-line comment test

* match read.table for na.strings and comment.char

* add strip.white=FALSE header testcase

* refactor end_of_field helper into more readable version

* add example for strip.white

* summarize line-skipping behavior

* clean up tmp

* don't introduce whitespace to string literal body

---------

Co-authored-by: Michael Chirico <chiricom@google.com>
@venom1204 venom1204 closed this Oct 21, 2025
@venom1204 venom1204 deleted the issue____2611 branch October 21, 2025 18:32
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.

bug in week means first week only has 6 days?

5 participants