diff --git a/TestBookAppointment.py b/TestBookAppointment.py new file mode 100644 index 0000000..f076d51 --- /dev/null +++ b/TestBookAppointment.py @@ -0,0 +1,11 @@ +from WriteDB import AppendAppointment + +def TestBookAppointment(): + date_1 = "2024-09-16" + start_time_1 = "10:30:00" + interviewee_name_1 = "Alice Johnson" + interviewee_email_1 = "ahmadmuhammadofficial@gmail.com" + print(f"\nTest Case 1: Trying to book {date_1} at {start_time_1} for {interviewee_name_1} ({interviewee_email_1})") + AppendAppointment(date_1, start_time_1, interviewee_name_1, interviewee_email_1) + +TestBookAppointment() \ No newline at end of file diff --git a/WriteDB.py b/WriteDB.py index 9073367..cf9ad46 100644 --- a/WriteDB.py +++ b/WriteDB.py @@ -1,7 +1,7 @@ import pandas as pd import json from openpyxl import load_workbook -#from send_email import send_email +from send_email import send_email from filelock import FileLock # Define the path to the Excel file and the lock file @@ -93,7 +93,7 @@ def AppendAppointment(date, start_time, interviewee_name, interviewee_email): email_cell.value = updated_emails workbook.save(file_path) - #send_email(interviewee_email, interviewee_name, date, start_time) + send_email(interviewee_email, interviewee_name, date, start_time) return True # If no slots available, return that the slot is unavailable @@ -116,7 +116,7 @@ def run_tests(): date_1 = "2024-09-16" start_time_1 = "10:30:00" interviewee_name_1 = "Alice Johnson" - interviewee_email_1 = "alice.johnson@example.com" + interviewee_email_1 = "ahmadmuhammadofficial@gmail.com" print(f"\nTest Case 1: Trying to book {date_1} at {start_time_1} for {interviewee_name_1} ({interviewee_email_1})") AppendAppointment(date_1, start_time_1, interviewee_name_1, interviewee_email_1) @@ -137,4 +137,5 @@ def run_tests(): AppendAppointment(date_3, start_time_3, interviewee_name_3, interviewee_email_3) # Run tests -run_tests() +if __name__ == "__main__": + run_tests() diff --git a/__pycache__/WriteDB.cpython-312.pyc b/__pycache__/WriteDB.cpython-312.pyc new file mode 100644 index 0000000..401e4ac Binary files /dev/null and b/__pycache__/WriteDB.cpython-312.pyc differ diff --git a/__pycache__/send_email.cpython-312.pyc b/__pycache__/send_email.cpython-312.pyc index 4cab579..1b561ac 100644 Binary files a/__pycache__/send_email.cpython-312.pyc and b/__pycache__/send_email.cpython-312.pyc differ diff --git a/interview_database.xlsx b/interview_database.xlsx index 9723383..e89113f 100644 Binary files a/interview_database.xlsx and b/interview_database.xlsx differ diff --git a/send_email.py b/send_email.py index 3a82b6d..736b75d 100644 --- a/send_email.py +++ b/send_email.py @@ -20,7 +20,7 @@ def send_email(interviewee_email="darkicewolf50@gmail.com", interviewee_name="br mst = pytz.timezone("America/Edmonton") # MST with Daylight Savings considered # Parse the input date and time, localize to MST - start_datetime = mst.localize(datetime.strptime(f"{date} {start_time}", "%d-%m-%Y %I:%M %p")) + start_datetime = mst.localize(datetime.strptime(f"{date} {start_time}", "%Y-%m-%d %H:%M:%S")) end_datetime = start_datetime + timedelta(minutes=30) # Format date and time for the calendar URLs @@ -78,4 +78,5 @@ def send_email(interviewee_email="darkicewolf50@gmail.com", interviewee_name="br except Exception as e: print(f"Failed to send email: {e}") -send_email() +if __name__ == "__main__": + send_email()