-
Notifications
You must be signed in to change notification settings - Fork 247
RecurrencePatternEvaluator: Modernize some evaluation code. #783
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RecurrencePatternEvaluator: Modernize some evaluation code. #783
Conversation
… pattern evaluation by making more use of the generator pattern.
Codecov ReportAttention: Patch coverage is
❌ 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. @@ Coverage Diff @@
## main #783 +/- ##
===================================
- Coverage 66% 66% -0%
===================================
Files 104 105 +1
Lines 4495 4438 -57
Branches 1140 1115 -25
===================================
- Hits 2969 2912 -57
- Misses 1061 1062 +1
+ Partials 465 464 -1
🚀 New features to boost your workflow:
|
f257d4e to
8869f89
Compare
8869f89 to
38727d8
Compare
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR modernizes the evaluation code in RecurrencePatternEvaluator by simplifying code patterns and reducing complexity. The changes improve clarity and reduce unnecessary code branches.
- Removed unneeded
.ToList()calls in favor of generator-based patterns - Refactored methods using LINQ and separated complex logic into simpler static methods
| if (r.ByHour?.Count > 0) r.ByHour = r.ByHour.OrderBy(x => x).ToList(); | ||
| if (r.ByMonth?.Count > 0) r.ByMonth = r.ByMonth.OrderBy(x => x).ToList(); | ||
|
|
||
| return r; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
|
|
||
| foreach (var d in monthDayDates) | ||
| yield return d; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice, tnx!
|
Thanks for the review! |



Modernize some code in
RecurrencePatternEvaluator, including.ToList()in favor of simpler generator based patternsAs a result the code gets simpler, more readable and we achieve the same functionality with less code and execution branches.