Handle confirmed homerooms; Added (C) footer

This commit is contained in:
Aaron Lee 2021-09-12 20:15:19 +08:00
parent 8ce46a8e1f
commit c727547530
6 changed files with 54 additions and 5 deletions

16
app.py
View file

@ -37,6 +37,8 @@ def check_login_status():
def manageProcess(fCommand, fData):
if (check_login_status()):
return redirect('/logout')
# this is to fix a bug where pyrebase doesnt load the first request
db.child("Users").child(
session['uid']).child("permission").get().val()
@ -86,6 +88,7 @@ def manageProcess(fCommand, fData):
print("got class")
homerooms = cateData['Homerooms']
currDate = ""
confirmed = []
absData = {}
for h in homerooms:
h = h.split('^')
@ -104,6 +107,7 @@ def manageProcess(fCommand, fData):
dow = tmpAbsData[currDate][j]
continue
elif j == "confirm":
confirmed.append([h[0], h[1]])
continue
if (tmpAbsData[currDate][j]['name'] == 'GP' and
tmpAbsData[currDate][j]['teacher'] == cclass['category']):
@ -119,6 +123,7 @@ def manageProcess(fCommand, fData):
dow = tmpAbsData[i][j]
continue
elif j == "confirm":
confirmed.append([h[0], h[1]])
continue
if (tmpAbsData[i][j]['name'] == 'GP' and
tmpAbsData[i][j]['teacher'] == cclass['category']):
@ -132,6 +137,7 @@ def manageProcess(fCommand, fData):
dow = tmpAbsData[currDate][j]
continue
elif j == "confirm":
confirmed.append([h[0], h[1]])
continue
if (tmpAbsData[currDate][j]['name'] == 'GP' and
tmpAbsData[currDate][j]['teacher'] == cclass['category']):
@ -155,7 +161,7 @@ def manageProcess(fCommand, fData):
"absent": num in tmpAbsData[currDate][p]
}
print(absData)
return render_template('group_teach.html', cclass=cclass, absData=absData, dow=dow, currDate=currDate, tmpAbsData=tmpAbsData)
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(
session['uid']).child("homeroom").get().val().split('^')
@ -222,6 +228,8 @@ def manage_admin():
@ app.route('/manage/group_teach_publish', methods=['POST'])
def group_teach_publish():
if (check_login_status()):
return redirect('/logout')
classes = db.child("Users").child(
session['uid']).child("class").get().val()
cclass = {}
@ -265,6 +273,9 @@ def group_teach_publish():
@ app.route('/manage/homeroom_abs', methods=['POST'])
def homeroom_abs_publish():
if (check_login_status()):
return redirect('/logout')
date = request.form['date']
homeroom = request.form['homeroom'].split('^')
period = request.form['period']
@ -293,6 +304,8 @@ def homeroom_abs_publish():
@app.route('/manage/homeroom_confirm', methods=['POST'])
def homeroom_confirm():
if (check_login_status()):
return redirect('/logout')
date = request.form['date']
homeroom = request.form['homeroom'].split('^')
signature = request.form['signatureData']
@ -306,6 +319,7 @@ def homeroom_confirm():
).put(os.path.join('temp', rand))
db.child("Homerooms").child(homeroom[0]).child(homeroom[1]).child("Absent").child(date).update(
{"confirm": str(storage.child(os.path.join('signatures', rand)).get_url(None))})
os.remove(os.path.join('temp', rand))
return redirect('/manage')

View file

@ -186,6 +186,13 @@
<div id="loading" style="text-align:center; width:100%; display:none;"><img src="/static/loading.gif" alt=""
style="height:100%;" />
</div>
<footer>
<hr>
<p style="text-align: center;">&copy; 2021 Attendance (β) | Made by <a target="_blank"
href="https://github.com/aaronleetw">Aaron Lee</a> for <a target="_blank"
href="https://www.fhjh.tp.edu.tw">Taipei Fuhsing Private School</a>
</p>
</footer>
<script>
var homerooms = {};
{% for i in homerooms %}

View file

@ -67,7 +67,7 @@
{% endif %}
{% else %}
<div class="col">
{% if 'confirm' in absData[i][grade][homeroom] %}
{% if [grade,homeroom] in confirmed %}
<p class="highlightAbs">--</p>
{% else %}
<input type="checkbox" class="{{grade}}^{{homeroom}}^{{student}}">
@ -135,6 +135,13 @@
<div id="loading" style="text-align:center; width:100%; display:none;"><img src="/static/loading.gif" alt=""
style="height:100%;" />
</div>
<footer>
<hr>
<p style="text-align: center;">&copy; 2021 Attendance (β) | Made by <a target="_blank"
href="https://github.com/aaronleetw">Aaron Lee</a> for <a target="_blank"
href="https://www.fhjh.tp.edu.tw">Taipei Fuhsing Private School</a>
</p>
</footer>
<script>
function loadingAnimation() {
$("div.container").hide();

View file

@ -194,7 +194,13 @@
<div id="loading" style="text-align:center; width:100%; display:none;"><img src="/static/loading.gif" alt=""
style="height:100%;" />
</div>
<footer>
<hr>
<p style="text-align: center;">&copy; 2021 Attendance (β) | Made by <a target="_blank"
href="https://github.com/aaronleetw">Aaron Lee</a> for <a target="_blank"
href="https://www.fhjh.tp.edu.tw">Taipei Fuhsing Private School</a>
</p>
</footer>
<script>
var signaturePad, hrCfrm = false;
function loadingAnimation() {
@ -253,6 +259,8 @@
}
function homeroomCfrm() {
hrCfrm = true;
$('.tobeform').attr('disabled', 'disabled');
$('.afterSelButton').attr('disabled', 'disabled');
showSignaturePad();
}
</script>

View file

@ -40,8 +40,14 @@
<div id="loading" style="text-align:center; width:100%; display:none;"><img src="/static/loading.gif" alt=""
style="height:100%;" />
</div>
<!-- end login form center -->
<script type="text/javascript" src="/static/jquery.min.js"></script>
<footer>
<hr>
<p style="text-align: center;">&copy; 2021 Attendance (β) | Made by <a target="_blank"
href="https://github.com/aaronleetw">Aaron Lee</a> for <a target="_blank"
href="https://www.fhjh.tp.edu.tw">Taipei Fuhsing Private School</a>
</p>
</footer>
<script type=" text/javascript" src="/static/jquery.min.js"></script>
<script>
function loadingAnimation() {
$('.container').hide();

View file

@ -49,6 +49,13 @@
<div id="loading" style="text-align:center; width:100%; display:none;"><img src="/static/loading.gif" alt=""
style="height:100%;" />
</div>
<footer>
<hr>
<p style="text-align: center;">&copy; 2021 Attendance (β) | Made by <a target="_blank"
href="https://github.com/aaronleetw">Aaron Lee</a> for <a target="_blank"
href="https://www.fhjh.tp.edu.tw">Taipei Fuhsing Private School</a>
</p>
</footer>
<script type="text/javascript" src="/static/jquery.min.js"></script>
<script>
function loadingAnimation() {