-
-
Save mmasztalerczuk/e8d70302ac2fbc1d42ea5646b30538ae to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def was_break(self): | |
driving_time = 0 | |
time_break = 0 | |
info_list = [] | |
short_break = False | |
long_break = False | |
max_time = 16200 | |
for record in self.records: | |
if record.get_mode() == 'D': | |
driving_time += record.get_value() | |
if x.get_mode() == 'R' | |
time_break += x.get_value() | |
if 1800 <= time_break and not long_break | |
long_break = True | |
time_break -= 1800 | |
max_time += 1800 | |
elif 900 <= time_break and not short_break | |
short_break = True | |
time_break -= 900 | |
max_time += 900 | |
#podmiana short na long | |
if 1800 <= time_break + 900 and short_break and not long_break | |
short_break = false | |
long_break = true | |
time_break -= 900 | |
max_time += 900 | |
if driving_time > max_time: | |
info = "Break needed!" | |
info_list.append(info) | |
return info_list |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment