Skip to content

Instantly share code, notes, and snippets.

@mmasztalerczuk
Last active May 12, 2017 10:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mmasztalerczuk/e8d70302ac2fbc1d42ea5646b30538ae to your computer and use it in GitHub Desktop.
Save mmasztalerczuk/e8d70302ac2fbc1d42ea5646b30538ae to your computer and use it in GitHub Desktop.
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