Skip to content

Conversation

@minichma
Copy link
Collaborator

@minichma minichma commented Feb 15, 2025

The expansion of BYMONTH, BYMONTHDAY, BYYEARDAY was incorrect when used together with BYWEEKNO, which is fixed in this PR. Corresponding tests are added.

Example test failing prior to the fix:

# 30.12 in WEEK 1 with expansion on BYMONTH, BYMONTHDAY, BYWEEKNO
RRULE:FREQ=YEARLY;BYMONTH=12;BYMONTHDAY=1,30;BYWEEKNO=1;UNTIL=20320101
DTSTART:20241230
INSTANCES:20241230,20251230,20301230,20311230

Closes #729

@codecov
Copy link

codecov bot commented Feb 15, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

❌ Your project status has failed because the head coverage (66%) is below the target coverage (80%). You can increase the head coverage or adjust the target coverage.

Impacted file tree graph

@@         Coverage Diff         @@
##           main   #731   +/-   ##
===================================
  Coverage    66%    66%           
===================================
  Files       105    105           
  Lines      4646   4649    +3     
  Branches   1154   1151    -3     
===================================
+ Hits       3067   3073    +6     
+ Misses     1143   1142    -1     
+ Partials    436    434    -2     
Files with missing lines Coverage Δ
Ical.Net/Evaluation/RecurrencePatternEvaluator.cs 91% <100%> (+1%) ⬆️

@minichma minichma force-pushed the work/minichma/bugfix/byweekno_expansion branch from 3ab7885 to 8f0643d Compare February 15, 2025 16:59
@minichma
Copy link
Collaborator Author

@axunonb Tried to slightly reduce cyclomatic complexity of GetByWeekNoVariants, to make CodeCov happy. Not sure this improves readability. Anyhow, improving the overall code structure is probably out of scope of this PR.

@minichma minichma requested a review from axunonb February 15, 2025 17:00
@minichma minichma marked this pull request as ready for review February 15, 2025 17:02
}
}

private sealed class ExpandContext
Copy link
Collaborator

Choose a reason for hiding this comment

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

use a struct or struct record instead, or even a bool instead?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, could be, and pass it by ref. Thought about it but went for simplicity. The overhead is rather low, but agree, struct would be nicer nevertheless. Will check.

RRULE:FREQ=YEARLY;BYYEARDAY=2;BYWEEKNO=53;UNTIL=20380102
DTSTART:20270102
INSTANCES:20270102,20330102,20380102

Copy link
Collaborator

Choose a reason for hiding this comment

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

👍

axunonb
axunonb previously approved these changes Feb 16, 2025
Copy link
Collaborator

@axunonb axunonb left a comment

Choose a reason for hiding this comment

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

Very nice! See minor remarks

@minichma minichma force-pushed the work/minichma/bugfix/byweekno_expansion branch from 8f0643d to 050e753 Compare February 16, 2025 08:37
@minichma
Copy link
Collaborator Author

Thanks for the review, improved as suggested. Nothing to see from you being not so responsive. ;-) Wish you a great journey!

@sonarqubecloud
Copy link

Copy link
Collaborator

@axunonb axunonb left a comment

Choose a reason for hiding this comment

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

Thanks for the wishes and the changes. Great!

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.

Incorrect behavior related to BYWEEKNO together with BYMONTH, BYMONTHDAY

3 participants