Skip to content

Commit

Permalink
fixes: fixed crashing when date was manually entered
Browse files Browse the repository at this point in the history
  • Loading branch information
divagicha committed May 17, 2021
1 parent 6a43a55 commit 77c184a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions CovidVaccineChecker/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ def create_new_user_config(self, user_config_file):

if date.strip() != "":
try:
self.appointment_date = dt.datetime.strptime(date, '%d-%m-%Y')
self.appointment_date = dt.datetime.strptime(date, '%d-%m-%Y').strftime('%d-%m-%Y')
except ValueError:
self.appointment_date = (dt.datetime.today()).strftime("%d-%m-%Y")
print(f"\n{TextColors.FAIL}Incorrect date format, should have been dd-mm-yyyy. Defaulted to today's date '{self.appointment_date}'...{TextColors.ENDC}")
Expand All @@ -235,7 +235,7 @@ def changeAppointmentDate(self, user_config_file):

if date.strip() != "":
try:
self.appointment_date = dt.datetime.strptime(date, '%d-%m-%Y')
self.appointment_date = dt.datetime.strptime(date, '%d-%m-%Y').strftime('%d-%m-%Y')
except ValueError:
self.appointment_date = (dt.datetime.today()).strftime("%d-%m-%Y")
print(f"\n{TextColors.FAIL}Incorrect date format, should have been dd-mm-yyyy. Defaulted to today's date '{self.appointment_date}'...{TextColors.ENDC}")
Expand Down Expand Up @@ -481,7 +481,7 @@ def schedule_appointment(self, all_centres, ref_ids, dose_number, min_age_limit,
print(f"\ntrying centre '{centre['name']}'\t{TextColors.BOLD}{TextColors.WARNING}(Min Age Limit: {centre['min_age_limit']}){TextColors.ENDC}...", end=" ")

dummy_centre_check = False
# dummy_centre_check = 'gdmc hos' in centre['name'].lower()
dummy_centre_check = 'gdmc hos' in centre['name'].lower()

if self.isValidCentre(centre, min_age_limit) or dummy_centre_check:
print(f"{TextColors.BOLD}{TextColors.WARNING}BOOKING{TextColors.ENDC}")
Expand Down

0 comments on commit 77c184a

Please sign in to comment.