From 466288dff275ba2d6f90ac192641ed65d68298e9 Mon Sep 17 00:00:00 2001 From: Aaron Lee Date: Tue, 12 Oct 2021 16:21:29 +0800 Subject: [PATCH] Remove access if homeroom teacher signed --- manage.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/manage.py b/manage.py index 9c1a4b1..b268839 100644 --- a/manage.py +++ b/manage.py @@ -240,6 +240,8 @@ def group_teach_publish(): "Absent").child(date).child(period).update({i[3]: int(i[0])}, session['token']) for h in cclass['homerooms']: h = h.split('^') + if "confirm" in db.child("Homerooms").child(h[0]).child(h[1]).child("Absent").child(date).get().val(): + continue db.child("Homerooms").child(h[0]).child(h[1]).child( "Absent").child(date).child(period).child("signature").update({cclass['class_id']: str(storage.child(os.path.join('signatures', rand)).get_url(None))}, session['token']) db.child("Homerooms").child(h[0]).child(h[1]).child( @@ -269,6 +271,8 @@ def homeroom_abs_publish(): signature = request.form['signatureData'] formData = request.form.to_dict() notes = "" + if "confirm" in db.child("Homerooms").child(homeroom[0]).child(homeroom[1]).child("Absent").child(date).get().val(): + return redirect('/manage') if 'notes' in request.form: notes = request.form['notes'] formData.pop('notes')