Show name to GP class records

This commit is contained in:
Aaron Lee 2021-09-16 21:19:10 +08:00
parent 09ab2230a5
commit 6cc8ac342c
4 changed files with 17 additions and 11 deletions

6
app.py
View file

@ -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:

View file

@ -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

View file

@ -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'] %}
<div class="row">{{periods[c-1]}}: {{absData[currDate][periods[c-1]]['teacher']}}: {{i}}</div>
<div class="row">{{periods[c-1]}}: {{absData[currDate][periods[c-1]]['teacher']}}: {{i}}:
{{absData[currDate][periods[c-1]]['names'][i]}}</div>
<div class="row"><img src="{{absData[currDate][periods[c-1]]['signature'][i]}}" alt=""><br>備註:
{{absData[currDate][periods[c-1]]['notes']}}</div>
{% endfor %}

View file

@ -164,13 +164,18 @@
{% endif %}
<div class="col half">
{% if c == 0 %}
<div class="row">Homeroom Teacher</div>
<div class="row">Homeroom Teacher 導師</div>
{% if 'confirm' in absData[currDate] %}
<div class="row"><img src="{{absData[currDate]['confirm']}}" alt=""></div>
{% else %}
<div class="row"><span style="color:red;">No Signature 導師尚未簽名</span></div>
{% 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'] %}
<div class="row">{{periods[c-1]}}: {{absData[currDate][periods[c-1]]['teacher']}}: {{i}}</div>
<div class="row">{{periods[c-1]}}: {{absData[currDate][periods[c-1]]['teacher']}}: {{i}}:
{{absData[currDate][periods[c-1]]['names'][i]}}</div>
<div class="row"><img src="{{absData[currDate][periods[c-1]]['signature'][i]}}" alt=""><br>備註:
{{absData[currDate][periods[c-1]]['notes']}}</div>
{% endfor %}