From 63a3ff1346ea67ae47b1557537426c82045c43b4 Mon Sep 17 00:00:00 2001 From: Aaron Lee Date: Mon, 13 Sep 2021 22:42:12 +0800 Subject: [PATCH] Added late option; Added chinese name to footer --- app.py | 16 +++---- static/allpages.css | 39 +++++++++-------- templates/admin.html | 4 +- templates/group_teach.html | 29 ++++++++++--- templates/homeroom.html | 87 ++++++++++++++++++++++---------------- templates/login.html | 4 +- templates/uploadcsv.html | 4 +- 7 files changed, 107 insertions(+), 76 deletions(-) diff --git a/app.py b/app.py index dd34cca..e9c967d 100644 --- a/app.py +++ b/app.py @@ -97,7 +97,6 @@ def manageProcess(fCommand, fData): absData = {} for h in homerooms: h = h.split('^') - print(h) hrData = db.child("Homerooms").child(h[0]).child(h[1]).get().val() tmpAbsData = hrData['Absent'] hrData.pop('Absent') @@ -163,9 +162,8 @@ def manageProcess(fCommand, fData): "eng_name": hrData[num]['eng_name'], "alr_fill": ('signature' in tmpAbsData[currDate][p] and cclass['class_id'] in tmpAbsData[currDate][p]['signature']), - "absent": num in tmpAbsData[currDate][p] + "absent": False if not num in tmpAbsData[currDate][p] else tmpAbsData[currDate][p][num] } - print(absData) return render_template('group_teach.html', cclass=cclass, absData=absData, dow=dow, currDate=currDate, tmpAbsData=tmpAbsData, confirmed=confirmed) elif pl == 'homeroom': homeroom = db.child("Users").child( @@ -204,7 +202,6 @@ def manageProcess(fCommand, fData): currDate = i if i >= datetime.now(tz).strftime("%Y-%m-%d"): break - print(currPeriod) return render_template('homeroom.html', absData=absData, homeroomCode=homeroom, homeroomData=homeroomData, currDate=currDate, periods=['m', '1', '2', '3', '4', 'n', '5', '6', '7', '8', '9'], currPeriod=currPeriod) else: @@ -270,7 +267,6 @@ def group_teach_publish(): "homerooms": db.child("Classes").child( "GP_Class").child(i).child("Homerooms").get().val() } - print("got class") date = request.form['date'] period = request.form['period'] signature = request.form['signatureData'] @@ -289,8 +285,8 @@ def group_teach_publish(): formData.pop('period') for i in formData: i = i.split('^') - db.child("Homerooms").child(i[0]).child(i[1]).child( - "Absent").child(date).child(period).update({i[2]: 0}) + db.child("Homerooms").child(i[1]).child(i[2]).child( + "Absent").child(date).child(period).update({i[3]: int(i[0])}) for h in cclass['homerooms']: h = h.split('^') db.child("Homerooms").child(h[0]).child(h[1]).child( @@ -322,8 +318,9 @@ def homeroom_abs_publish(): formData.pop('homeroom') formData.pop('period') for i in formData: + i = i.split('^') db.child("Homerooms").child(homeroom[0]).child( - homeroom[1]).child("Absent").child(date).child(period).update({i: 0}) + homeroom[1]).child("Absent").child(date).child(period).update({i[1]: int(i[0])}) db.child("Homerooms").child(homeroom[0]).child(homeroom[1]).child( "Absent").child(date).child(period).update({'signature': str(storage.child(os.path.join('signatures', rand)).get_url(None))}) os.remove(os.path.join('temp', rand)) @@ -451,7 +448,6 @@ def upload_period_list(): periodCodes = csv_dict['Period Day'].tolist() for i in range(5): tmp_csv = csv_dict[str(i+1)].tolist() - print(tmp_csv) for j in range(len(tmp_csv)): if not (periodCodes[j].endswith('-t')): if type(tmp_csv[j]) == float: @@ -490,8 +486,6 @@ def upload_dates(): for i in temp[t]: periodData = db.child("Classes").child( "Homeroom").child(t).child(i).get().val() - print(type(t), t) - print(type(i), i) db.child("Homerooms").child(t).child(i).child( "Absent").child(h).update({"dow": row[h]}) db.child("Homerooms").child(t).child(i).child( diff --git a/static/allpages.css b/static/allpages.css index 3de4350..aa652ff 100644 --- a/static/allpages.css +++ b/static/allpages.css @@ -50,11 +50,15 @@ p.highlightAbs.n-2 { color: red; } +p.highlightAbs.n-3 { + color: rgb(15, 184, 0); +} + .margin-top { margin-top: 20px; } -input[type="checkbox"]{ +input[type="checkbox"].absent, input[type="checkbox"].late { -webkit-appearance: initial; appearance: initial; background: rgb(207, 207, 207); @@ -64,16 +68,26 @@ input[type="checkbox"]{ margin-top: 3px; position: relative; } -input[type="checkbox"]:checked { +input[type="checkbox"].absent:checked { background: red; } -input[type="checkbox"]:checked:after { - /* Heres your symbol replacement */ +input[type="checkbox"].absent:checked:after { content: "X"; - color: #fff; - /* The following positions my tick in the center, - * but you could just overlay the entire box - * with a full after element with a background if you want to */ + color: white; + position: absolute; + left: 50%; + top: 50%; + -webkit-transform: translate(-50%,-50%); + -moz-transform: translate(-50%,-50%); + -ms-transform: translate(-50%,-50%); + transform: translate(-50%,-50%); +} +input[type="checkbox"].late:checked { + background: rgb(15, 184, 0); +} +input[type="checkbox"].late:checked:after { + content: "φ"; + color: #fff; position: absolute; left: 50%; top: 50%; @@ -81,13 +95,4 @@ input[type="checkbox"]:checked:after { -moz-transform: translate(-50%,-50%); -ms-transform: translate(-50%,-50%); transform: translate(-50%,-50%); - /* - * If you want to fully change the check appearance, use the following: - * content: " "; - * width: 100%; - * height: 100%; - * background: blue; - * top: 0; - * left: 0; - */ } \ No newline at end of file diff --git a/templates/admin.html b/templates/admin.html index 2509b6c..6882344 100644 --- a/templates/admin.html +++ b/templates/admin.html @@ -189,10 +189,10 @@