-
Notifications
You must be signed in to change notification settings - Fork 323
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
Add business days functions to Date and Date_Time #3726
Add business days functions to Date and Date_Time #3726
Conversation
4ce4383
to
a2bcfea
Compare
Seems that in some places callbacks were created by |
I think in many places we use dataflow errors for 'control-flow'. I think this may be a relic of the fact that in the past dataflow errors did not have stack traces and were much faster to construct (just a hypothesis though). This has changed and now they incur a significant performance cost. I think we may consider adding a task to review their usage (I assume we want the stacktraces as they aid debugging) - maybe we should try to revisit our stdlib and check where we can replace dataflow errors with a cheaper mechanism. Or maybe we should give the user control over whether the dataflow error will get the stacktrace or not - then we could still have cheap dataflow errors for control flow and expensive ones for true error reporting. @jdunkerley @JaroslavTulach @hubertp what do you think? |
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.
LGTM - couple of suggestions and one comment fix.
distribution/lib/Standard/Base/0.0.0-dev/src/Data/Time/Date.enso
Outdated
Show resolved
Hide resolved
distribution/lib/Standard/Base/0.0.0-dev/src/Data/Time/Date_Time.enso
Outdated
Show resolved
Hide resolved
starting point), the last week (containing the end point), and the full | ||
weeks in between those. In some cases there may be no weeks in-between | ||
and the first and last week can be the same week. | ||
start_of_first_full_week = Time_Utils.start_of_next_week start |
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.
I feel this calls for start.start_of Date_Period.Week
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.
Well yes, but we did not implement the Week
variant as you told me we want to postpone it because there are the complications with the "which day is the start of the week".
I avoided adding it to avoid adding additional features as I feel I sometimes tend to do that and then get the PR delayed because of it. So I decided to go for the simple solution - create a private helper which does only the job we need it to - being much simpler then the whole logic needed for start_of Date_Period.Week
machinery.
Still - if you think this is the right time to implement start_of Date_Period.Week
- I'm happy to do that. Do we want to add a start_of_week=Day_Of_Week.Monday
setting which can be overridden?
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.
Still I'd suggest doing it as a separate PR, just to move this forward and avoid mixing features in a single PR. Then we can replace these helper functions here in that next PR.
Happy with that
Get Outlook for iOS<https://aka.ms/o0ukef>
________________________________
From: Radosław Waśko ***@***.***>
Sent: Wednesday, September 21, 2022 8:49:20 PM
To: enso-org/enso ***@***.***>
Cc: James Dunkerley ***@***.***>; Mention ***@***.***>
Subject: Re: [enso-org/enso] Add business days functions to Date and Date_Time (PR #3726)
@radeusgd commented on this pull request.
________________________________
In distribution/lib/Standard/Base/0.0.0-dev/src/Data/Time/Date.enso<#3726 (comment)>:
@@ -355,3 +504,39 @@ type Date
== self that =
sign = Time_Utils.compare_to_localdate self that
0 == sign
+
+## PRIVATE
+week_days_between start end =
+ ## We split the interval into 3 periods: the first week (containing the
+ starting point), the last week (containing the end point), and the full
+ weeks in between those. In some cases there may be no weeks in-between
+ and the first and last week can be the same week.
+ start_of_first_full_week = Time_Utils.start_of_next_week start
Still I'd suggest doing it as a separate PR, just to move this forward and avoid mixing features in a single PR. Then we can replace these helper functions here in that next PR.
—
Reply to this email directly, view it on GitHub<#3726 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ABD3MOMO4WQEWW7YF2MJMFTV7NREBANCNFSM6AAAAAAQRLYYHM>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
TODO once this is implemented we want an analogous test suite for Date_Time
some spec clarifications are still needed
Does not work yet (:
…ll-defined. Users can manually convert to Date and then the intent is much much clearer.
still there may be some off by one error
a2bcfea
to
de5d72d
Compare
Pull Request Description
Implements https://www.pivotaltracker.com/story/show/183082087
Important Notes
Error.throw
improving performance ofVector.distinct
. The time of theadd_work_days and work_days_until should be consistent with each other
test suite came down from 15s to 3s after the changes.Checklist
Please include the following checklist in your PR:
Scala,
Java,
and
Rust
style guides.
./run ide build
and./run ide watch
.