fix(backend): reject is dumb
All checks were successful
Publish docker image / Publish (push) Successful in 1m47s

This commit is contained in:
Ashhhleyyy 2024-03-11 11:09:22 +00:00
parent 53f257bc4b
commit b4634f2a36
Signed by: ash
GPG key ID: 83B789081A0878FB

View file

@ -21,6 +21,14 @@ async def reject_proxy(date: str, time: str, activity: str, space: str):
async with session.get('https://rejectdopamine.com/api/app/active/yrk/cs/1') as resp: async with session.get('https://rejectdopamine.com/api/app/active/yrk/cs/1') as resp:
response = await resp.json() response = await resp.json()
activities = [] activities = []
if 'sessions' not in response:
return {
'date': date,
'time': time,
'space': space,
'activity': activity,
'codes': [],
}
for session in response['sessions']: for session in response['sessions']:
if reformat_reject_date(session['startDate']) == date and time == f'{session["startTime"]} - {session["endTime"]}' and session['location'] in space: if reformat_reject_date(session['startDate']) == date and time == f'{session["startTime"]} - {session["endTime"]}' and session['location'] in space:
# Likely a correct result, let's return it # Likely a correct result, let's return it