Skip to content
This repository has been archived by the owner on Jan 1, 2023. It is now read-only.

Commit

Permalink
Fix earliest_day parameter
Browse files Browse the repository at this point in the history
Fixes a bug where we're trying to work with an earliest day that might
be None.

Fixes: #1
  • Loading branch information
muffix committed Nov 27, 2021
1 parent 6cf67db commit d87065a
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions impf.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,9 +254,9 @@ def find(self, earliest_day: Optional[str] = None, *, book: bool = False) -> boo
True if the booking was successful or an appointment was found and no booking requested.
"""
if earliest_day is None:
earliest_day = date.today().isoformat()
earliest_day = date.today()

appt = self._find_appointment(earliest_day)
appt = self._find_appointment(earliest_day.isoformat())
if appt is None:
logging.info("No appointment available")
return False
Expand Down Expand Up @@ -380,12 +380,10 @@ def main():
):
with attempt:
logging.debug("Trying to find appointment (attempt %d)", i)
if not checker.find(
earliest_day=args.earliest_day.isoformat(), book=args.book
):
if not checker.find(earliest_day=args.earliest_day, book=args.book):
raise Exception("Unsuccessful attempt")
else:
checker.find(earliest_day=args.earliest_day.isoformat(), book=args.book)
checker.find(earliest_day=args.earliest_day, book=args.book)

if args.book:
checker.print_appointments()
Expand Down

0 comments on commit d87065a

Please sign in to comment.