-
Notifications
You must be signed in to change notification settings - Fork 41
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
[FIX] beesdoo_shift: forbid illegal hour #292
base: 12.0
Are you sure you want to change the base?
Conversation
88611e3
to
61a83e4
Compare
It was possible to encode shift that start at negative hour or hour bigger then 24. Of course this lead to some error at the moment we generate the planning for a given date - Add a constraint on start_time and end_time - Fix onchange on duration: duration was not computed properly when the start or end time was 00:00
61a83e4
to
6a36584
Compare
Codecov Report
@@ Coverage Diff @@
## 12.0 #292 +/- ##
==========================================
- Coverage 68.53% 68.53% -0.01%
==========================================
Files 107 107
Lines 3366 3369 +3
Branches 589 590 +1
==========================================
+ Hits 2307 2309 +2
Misses 951 951
- Partials 108 109 +1
Continue to review full report at Codecov.
|
@api.onchange("start_time", "end_time") | ||
def _get_duration(self): | ||
if self.start_time and self.end_time: | ||
self.duration = self.end_time - self.start_time | ||
self.duration = (self.end_time or 0.0) - (self.start_time or 0.0) |
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'd rather return False when start_time
or end_time
instead of these weird values.
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.
self.duration = (self.end_time or 0.0) - (self.start_time or 0.0) | |
if self.start_time and self.end_time: | |
self.duration = self.end_time - self.start_time | |
else: | |
self.duration = False | |
abc40d1
to
fa7679b
Compare
It was possible to encode shift that start at negative hour
or hour bigger then 24. Of course this lead to some
error at the moment we generate the planning for a given date
when the start or end time was 00:00