mirror of
https://github.com/UofCBaja/BajaCloud.git
synced 2025-06-15 05:04:17 -06:00
fix(master): found a bug and fixed datetime not match in cell
This commit is contained in:
parent
595c5143ab
commit
6917a390cf
@ -82,7 +82,7 @@ if __name__ == "__main__":
|
||||
year_donation = int(str(datetime.datetime.now().year)[2:]) + 1 # gets the last two digits of the current year then adds 1 for the current season
|
||||
# name based off the 2025 naming system
|
||||
# Define the path to the Excel file and the lock file
|
||||
file_name = f"./Interviews/OR{year_donation}-L-Interview Data.xlsx"
|
||||
file_name = f"../Interviews/OR{year_donation}-L-Interview Data.xlsx"
|
||||
try:
|
||||
data = ReadDatabase(file_name)
|
||||
print(json.dumps(data, indent=4))
|
||||
|
@ -1,5 +1,6 @@
|
||||
import pandas as pd
|
||||
import json
|
||||
import datetime
|
||||
from openpyxl import load_workbook
|
||||
from .send_email import send_email
|
||||
from filelock import FileLock
|
||||
@ -33,7 +34,8 @@ def ReadDatabase(file_path, lock_path):
|
||||
# Process each row in the DataFrame to structure data by date and time
|
||||
for _, row in df.iterrows():
|
||||
# Convert Date and Start Time to string format for easier comparison
|
||||
date = str(row['Date']).split(" ")[0] # Format date to YYYY-MM-DD
|
||||
date = str(row['Date']).split(" ")[0] # Extract the date part
|
||||
|
||||
start_time = str(row['Start Time Slot'])
|
||||
|
||||
# Calculate the slot capacity and current number of interviewees
|
||||
|
@ -1,6 +1,8 @@
|
||||
import datetime
|
||||
from .ReadDB import ReadDatabase
|
||||
|
||||
|
||||
|
||||
def getSchedulePackager(file_name):
|
||||
"""
|
||||
Packages up the response for a http response
|
||||
@ -39,7 +41,8 @@ def SelectAppointment (file_name, appointmentJson):
|
||||
try:
|
||||
validEmail = validate_email(appointmentJson["intervieweeEmail"], check_deliverability=True)
|
||||
if validEmail:
|
||||
status = AppendAppointment(file_path=file_name, date=appointmentJson["date"], start_time=appointmentJson["startTime"], interviewee_name=appointmentJson["intervieweeName"], interviewee_email=appointmentJson["intervieweeEmail"])
|
||||
date_formatted = datetime.datetime.strptime(appointmentJson["date"], '%m/%d/%Y').strftime('%Y-%m-%d')
|
||||
status = AppendAppointment(file_path=file_name, date=date_formatted, start_time=appointmentJson["startTime"], interviewee_name=appointmentJson["intervieweeName"], interviewee_email=appointmentJson["intervieweeEmail"])
|
||||
|
||||
if status:
|
||||
resBody = {"Success": True, "validEmail": "true"}
|
||||
|
8
main.py
8
main.py
@ -10,7 +10,7 @@ import os
|
||||
year_donation = int(str(datetime.datetime.now().year)[2:]) + 1 # gets the last two digits of the current year then adds 1 for the current season
|
||||
# name based off the 2025 naming system
|
||||
# Define the path to the Excel file and the lock file
|
||||
file_name = f"/Interviews/OR{year_donation}-L-Interview Data.xlsx"
|
||||
file_name = f"./Interviews/OR{year_donation}-L-Interview Data.xlsx"
|
||||
if not os.path.isfile(file_name):
|
||||
os.makedirs(os.path.dirname(file_name), exist_ok=True)
|
||||
NoSheet(file_name)
|
||||
@ -143,10 +143,9 @@ async def postSelectInterview(rawRequest: Appointment):
|
||||
``Contact``: darkicewolf50@gmail.com
|
||||
|
||||
"""
|
||||
|
||||
requestDict = {key: str(value) for key, value in rawRequest.dict().items()}
|
||||
requestDict = {key: str(value) for key, value in rawRequest.model_dump().items()}
|
||||
res = SelectAppointment(file_name, requestDict)
|
||||
|
||||
|
||||
return JSONResponse(
|
||||
headers={
|
||||
"isBase64Encoded": "false", # Header Modification
|
||||
@ -161,4 +160,3 @@ async def postSelectInterview(rawRequest: Appointment):
|
||||
|
||||
# status_code=200 commented out just to show how to change it if you wanted
|
||||
)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user