Skip to content
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

Preserve "step intertia" when calculating a next or previous date #52

Merged
merged 6 commits into from
Feb 24, 2017

Conversation

alonsodomin
Copy link
Owner

Fixes #50

Step intertia refers to carrying over the direction of the step operation across the different fields in the Cron expression even when the carry over value from the previous field is equal to 0. Ignoring this inertia results in invalid result values for those fields constrained by non-continuous sub-expressions and other potential side effects.

This PR fixes this problem and adds a regression test to prevent future ocurrences.

@codecov-io
Copy link

Codecov Report

Merging #52 into master will increase coverage by 0.01%.
The diff coverage is 100%.

@@            Coverage Diff             @@
##           master      #52      +/-   ##
==========================================
+ Coverage   94.37%   94.39%   +0.01%     
==========================================
  Files          58       58              
  Lines         818      820       +2     
  Branches       44       32      -12     
==========================================
+ Hits          772      774       +2     
  Misses         46       46
Impacted Files Coverage Δ
...hared/src/main/scala/cron4s/datetime/Stepper.scala 100% <100%> (ø)
...ain/scala/cron4s/testkit/laws/EnumeratedLaws.scala 100% <100%> (ø)
...ared/src/main/scala/cron4s/syntax/enumerated.scala 100% <100%> (ø)
.../src/main/scala/cron4s/datetime/DateTimeCron.scala 86.36% <100%> (+0.31%)
...main/scala/cron4s/testkit/discipline/package.scala 100% <100%> (ø)
...shared/src/main/scala/cron4s/base/Enumerated.scala 100% <100%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f4cbca0...2eea487. Read the comment docs.

@alonsodomin alonsodomin merged commit 119aefe into master Feb 24, 2017
@alonsodomin alonsodomin deleted the step_hotfix branch February 24, 2017 19: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.

Wrong datetime result with Cron.next() with seconds='*'
2 participants