From 6cc8ac342c20110e360d25cc24076f82752c4e64 Mon Sep 17 00:00:00 2001 From: Aaron Lee Date: Thu, 16 Sep 2021 21:19:10 +0800 Subject: [PATCH] Show name to GP class records --- app.py | 6 +++--- requirements.txt | 10 +++++----- templates/admin.html | 3 ++- templates/homeroom.html | 9 +++++++-- 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/app.py b/app.py index dc9db06..a19b3f4 100644 --- a/app.py +++ b/app.py @@ -9,7 +9,6 @@ import pandas as pd import base64 from random import randint from dotenv import load_dotenv -from pprint import pprint load_dotenv() app = Flask(__name__) @@ -97,7 +96,6 @@ def manageProcess(fCommand, fData): "category": i, "class_id": classes[i] } - print("got class") homerooms = cateData['Homerooms'] currDate = "" confirmed = [] @@ -272,7 +270,7 @@ def group_teach_publish(): cclass = {} for i in classes: cclass = { - "name": db.child("Classes").child(i).child( + "name": db.child("Classes").child("GP_Class").child(i).child( "Class").child(classes[i]).child("name").get().val(), "category": i, "class_id": classes[i], @@ -306,6 +304,8 @@ def group_teach_publish(): h = h.split('^') 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))}) + db.child("Homerooms").child(h[0]).child(h[1]).child( + "Absent").child(date).child(period).child("names").child(cclass['class_id']).set(cclass['name']) currPeriodData = db.child("Homerooms").child(h[0]).child(h[1]).child( "Absent").child(date).child(period).get().val() if 'notes' in currPeriodData: diff --git a/requirements.txt b/requirements.txt index a38c6ca..b0db49f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,19 +1,19 @@ # Automatically generated by https://github.com/damnever/pigar. -# Attendance/app.py: 1 +# Attendance/app.py: 2 Flask == 2.0.1 -# Attendance/app.py: 2 +# Attendance/app.py: 3 # Attendance/test.py: 1 Pyrebase == 3.0.27 -# Attendance/app.py: 7 +# Attendance/app.py: 8 pandas == 1.1.3 -# Attendance/app.py: 10 +# Attendance/app.py: 11 # Attendance/test.py: 3 python_dotenv == 0.19.0 -# Attendance/app.py: 4 +# Attendance/app.py: 5 pytz == 2020.1 gunicorn == 20.1.0 \ No newline at end of file diff --git a/templates/admin.html b/templates/admin.html index 5d7cc24..992b129 100644 --- a/templates/admin.html +++ b/templates/admin.html @@ -141,7 +141,8 @@ {% if absData[currDate][periods[c-1]]['name'] == 'GP' %} {% if 'signature' in absData[currDate][periods[c-1]] %} {% for i in absData[currDate][periods[c-1]]['signature'] %} -
{{periods[c-1]}}: {{absData[currDate][periods[c-1]]['teacher']}}: {{i}}
+
{{periods[c-1]}}: {{absData[currDate][periods[c-1]]['teacher']}}: {{i}}: + {{absData[currDate][periods[c-1]]['names'][i]}}

備註: {{absData[currDate][periods[c-1]]['notes']}}
{% endfor %} diff --git a/templates/homeroom.html b/templates/homeroom.html index 78c3b69..34e7e95 100644 --- a/templates/homeroom.html +++ b/templates/homeroom.html @@ -164,13 +164,18 @@ {% endif %}
{% if c == 0 %} -
Homeroom Teacher
+
Homeroom Teacher 導師
+ {% if 'confirm' in absData[currDate] %}
{% else %} +
No Signature 導師尚未簽名
+ {% endif %} + {% else %} {% if absData[currDate][periods[c-1]]['name'] == 'GP' %} {% if 'signature' in absData[currDate][periods[c-1]] %} {% for i in absData[currDate][periods[c-1]]['signature'] %} -
{{periods[c-1]}}: {{absData[currDate][periods[c-1]]['teacher']}}: {{i}}
+
{{periods[c-1]}}: {{absData[currDate][periods[c-1]]['teacher']}}: {{i}}: + {{absData[currDate][periods[c-1]]['names'][i]}}

備註: {{absData[currDate][periods[c-1]]['notes']}}
{% endfor %}