mirror of
https://github.com/UofCBaja/BajaCloud.git
synced 2025-06-15 13:14: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
|
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
|
# name based off the 2025 naming system
|
||||||
# Define the path to the Excel file and the lock file
|
# 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:
|
try:
|
||||||
data = ReadDatabase(file_name)
|
data = ReadDatabase(file_name)
|
||||||
print(json.dumps(data, indent=4))
|
print(json.dumps(data, indent=4))
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import pandas as pd
|
import pandas as pd
|
||||||
import json
|
import json
|
||||||
|
import datetime
|
||||||
from openpyxl import load_workbook
|
from openpyxl import load_workbook
|
||||||
from .send_email import send_email
|
from .send_email import send_email
|
||||||
from filelock import FileLock
|
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
|
# Process each row in the DataFrame to structure data by date and time
|
||||||
for _, row in df.iterrows():
|
for _, row in df.iterrows():
|
||||||
# Convert Date and Start Time to string format for easier comparison
|
# 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'])
|
start_time = str(row['Start Time Slot'])
|
||||||
|
|
||||||
# Calculate the slot capacity and current number of interviewees
|
# Calculate the slot capacity and current number of interviewees
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
|
import datetime
|
||||||
from .ReadDB import ReadDatabase
|
from .ReadDB import ReadDatabase
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def getSchedulePackager(file_name):
|
def getSchedulePackager(file_name):
|
||||||
"""
|
"""
|
||||||
Packages up the response for a http response
|
Packages up the response for a http response
|
||||||
@ -39,7 +41,8 @@ def SelectAppointment (file_name, appointmentJson):
|
|||||||
try:
|
try:
|
||||||
validEmail = validate_email(appointmentJson["intervieweeEmail"], check_deliverability=True)
|
validEmail = validate_email(appointmentJson["intervieweeEmail"], check_deliverability=True)
|
||||||
if validEmail:
|
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:
|
if status:
|
||||||
resBody = {"Success": True, "validEmail": "true"}
|
resBody = {"Success": True, "validEmail": "true"}
|
||||||
|
6
main.py
6
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
|
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
|
# name based off the 2025 naming system
|
||||||
# Define the path to the Excel file and the lock file
|
# 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):
|
if not os.path.isfile(file_name):
|
||||||
os.makedirs(os.path.dirname(file_name), exist_ok=True)
|
os.makedirs(os.path.dirname(file_name), exist_ok=True)
|
||||||
NoSheet(file_name)
|
NoSheet(file_name)
|
||||||
@ -143,8 +143,7 @@ async def postSelectInterview(rawRequest: Appointment):
|
|||||||
``Contact``: darkicewolf50@gmail.com
|
``Contact``: darkicewolf50@gmail.com
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
requestDict = {key: str(value) for key, value in rawRequest.model_dump().items()}
|
||||||
requestDict = {key: str(value) for key, value in rawRequest.dict().items()}
|
|
||||||
res = SelectAppointment(file_name, requestDict)
|
res = SelectAppointment(file_name, requestDict)
|
||||||
|
|
||||||
return JSONResponse(
|
return JSONResponse(
|
||||||
@ -161,4 +160,3 @@ async def postSelectInterview(rawRequest: Appointment):
|
|||||||
|
|
||||||
# status_code=200 commented out just to show how to change it if you wanted
|
# status_code=200 commented out just to show how to change it if you wanted
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user