Change date access according to the format

This commit is contained in:
Aaron Lee 2021-10-03 18:00:15 +08:00
parent 48904c756f
commit 05332bb768

View file

@ -242,15 +242,14 @@ def upload_dates():
temp = db.child("Homerooms").get(session['token']).val() temp = db.child("Homerooms").get(session['token']).val()
for row in csv_dict: for row in csv_dict:
for h in headers: for h in headers:
h = h.replace('/', '-')
for t in temp: for t in temp:
for i in temp[t]: for i in temp[t]:
periodData = db.child("Classes").child( periodData = db.child("Classes").child(
"Homeroom").child(t).child(i).get(session['token']).val() "Homeroom").child(t).child(i).get(session['token']).val()
db.child("Homerooms").child(t).child(i).child( db.child("Homerooms").child(t).child(i).child(
"Absent").child(h).update({"dow": row[h.replace('-', '/')]}, session['token']) "Absent").child(h).update({"dow": row[h]}, session['token'])
db.child("Homerooms").child(t).child(i).child( db.child("Homerooms").child(t).child(i).child(
"Absent").child(h).update(periodData[int(row[h.replace('-', '/')])], session['token']) "Absent").child(h).update(periodData[int(row[h])], session['token'])
os.remove(filepath) os.remove(filepath)
except Exception as e: except Exception as e:
os.remove(filepath) os.remove(filepath)