Skip to content

Commit

Permalink
Merge pull request timreibe#272 from haslersn/zeitrahmen-uhrzeit-plus…
Browse files Browse the repository at this point in the history
…-59s

feat(zeitrahmen): Add 59s leeway to bis_uhrzeit
  • Loading branch information
timreibe authored Jun 2, 2021
2 parents cdcca2b + da0fa00 commit d1443a9
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions tools/its.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import sys
import time
from base64 import b64encode
from datetime import datetime, date
from datetime import datetime, date, timedelta
from datetime import time as dtime
from random import choice, randint

Expand Down Expand Up @@ -804,7 +804,7 @@ def terminpaar_im_zeitrahmen(terminpaar, zeitrahmen):
:param zeitrahmen: Zeitrahmen-Dictionary wie in ImpfterminService.termin_suchen
:return: True oder False
"""
if not zeitrahmen: # Teste auf leeres dict
if not zeitrahmen: # Teste auf leeres dict
return True

assert zeitrahmen["einhalten_bei"] in ["1", "2", "beide"]
Expand All @@ -818,9 +818,10 @@ def terminpaar_im_zeitrahmen(terminpaar, zeitrahmen):
von_uhrzeit = datetime.strptime(
zeitrahmen["von_uhrzeit"],
"%H:%M").time() if "von_uhrzeit" in zeitrahmen else dtime.min
bis_uhrzeit = datetime.strptime(
zeitrahmen["bis_uhrzeit"],
"%H:%M").time() if "bis_uhrzeit" in zeitrahmen else dtime.max
bis_uhrzeit = (
datetime.strptime(zeitrahmen["bis_uhrzeit"], "%H:%M")
+ timedelta(seconds=59)
).time() if "bis_uhrzeit" in zeitrahmen else dtime.max
wochentage = [decode_wochentag(wt) for wt in set(
zeitrahmen["wochentage"])] if "wochentage" in zeitrahmen else range(7)

Expand Down

0 comments on commit d1443a9

Please sign in to comment.