Add emoji and func to show only 2-curr-4 in HR or GP

This commit is contained in:
Aaron Lee 2021-10-18 15:42:51 +08:00
parent 56957fdbdb
commit e2536ab19e
5 changed files with 25 additions and 26 deletions

View file

@ -138,7 +138,7 @@ def manageProcess(fCommand, fData):
cclass['class_id'] in tmpAbsData[currDate][p]['signature']), cclass['class_id'] in tmpAbsData[currDate][p]['signature']),
"absent": False if not num in tmpAbsData[currDate][p] else tmpAbsData[currDate][p][num] "absent": False if not num in tmpAbsData[currDate][p] else tmpAbsData[currDate][p][num]
} }
return render_template('group_teach.html', cclass=cclass, absData=absData, dow=dow, currDate=currDate, tmpAbsData=tmpAbsData, confirmed=confirmed) return render_template('group_teach.html', dateKeys=sorted(tmpAbsData.keys()), cclass=cclass, absData=absData, dow=dow, currDate=currDate, tmpAbsData=tmpAbsData, confirmed=confirmed)
elif pl == 'homeroom': elif pl == 'homeroom':
homeroom = session['homeroom'].split('^') homeroom = session['homeroom'].split('^')
homeroomData = db.child("Homerooms").child(homeroom[0]).child( homeroomData = db.child("Homerooms").child(homeroom[0]).child(
@ -177,7 +177,7 @@ def manageProcess(fCommand, fData):
if i >= datetime.now(tz).strftime("%Y-%m-%d"): if i >= datetime.now(tz).strftime("%Y-%m-%d"):
break break
return render_template('homeroom.html', absData=absData, homeroomCode=homeroom, homeroomData=homeroomData, 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) currDate=currDate, dateKeys=sorted(absData.keys()), periods=['m', '1', '2', '3', '4', 'n', '5', '6', '7', '8', '9'], currPeriod=currPeriod)
else: else:
return redirect('/logout') return redirect('/logout')

View file

@ -34,13 +34,6 @@
<h2 style="color: red; text-align: center;">Homeroom NOT Confirmed 班導尚未確認</h2> <h2 style="color: red; text-align: center;">Homeroom NOT Confirmed 班導尚未確認</h2>
{% endif %} {% endif %}
<a href="/logout"><button class="btn btn-primary logout margin-top">Logout 登出</button></a> <a href="/logout"><button class="btn btn-primary logout margin-top">Logout 登出</button></a>
<form action="/swapClass" method="post" id="swapClassForm" hidden>
<input type="text" name="homeroom" value="{{homeroomCode[0]}}^{{homeroomCode[1]}}">
<input type="text" name="date" value="{{currDate}}">
<input type="text" name="type" value="seewindow">
</form>
<a href="/swapClass/{{homeroomCode[0]}}/{{homeroomCode[1]}}/{{currDate}}"><button
class="btn btn-warning logout margin-top">Swap Classes 改、換課</button></a>
<div class="container margin-bottom"> <div class="container margin-bottom">
<div class="row"> <div class="row">
<div class="col"> <div class="col">
@ -60,7 +53,7 @@
<select name="date" id="date" class="form-select"> <select name="date" id="date" class="form-select">
{% for date in absData %} {% for date in absData %}
{% if date == currDate %} {% if date == currDate %}
<option value="{{date}}" selected="selected">{{date}}</option> <option value="{{date}}" selected="selected">{{date}}</option>
{% else %} {% else %}
<option value="{{date}}">{{date}}</option> <option value="{{date}}">{{date}}</option>
{% endif %} {% endif %}

View file

@ -31,11 +31,14 @@
<a href="/logout"><button class="btn btn-primary margin-top logout">Logout 登出</button></a> <a href="/logout"><button class="btn btn-primary margin-top logout">Logout 登出</button></a>
<a href="/select"><button class="btn btn-primary margin-top logout">Choose Subuser 選擇其他帳號</button></a> <a href="/select"><button class="btn btn-primary margin-top logout">Choose Subuser 選擇其他帳號</button></a>
<select name="date" id="date" class="form-select logout" onchange="chgDate();"> <select name="date" id="date" class="form-select logout" onchange="chgDate();">
{% for date in tmpAbsData %} {% for date in range(dateKeys|length) %}
{% if date == currDate %} {% if dateKeys[date] == currDate %}
<option value="{{date}}" selected="selected">{{date}}</option> {% if date-2 >= 0 %}<option value="{{dateKeys[date-2]}}">{{dateKeys[date-2]}}</option>{% endif %}
{% else %} {% if date-1 >= 0 %}<option value="{{dateKeys[date-1]}}">{{dateKeys[date-1]}}</option>{% endif %}
<option value="{{date}}">{{date}}</option> <option value="{{dateKeys[date]}}" selected="selected">{{dateKeys[date]}} ★</option>
{% for i in range(1,5) %}
{% if date+i < dateKeys|length %}<option value="{{dateKeys[date+i]}}">{{dateKeys[date+i]}}</option>{%endif%}
{% endfor %}
{% endif %} {% endif %}
{% endfor %} {% endfor %}
</select> </select>

View file

@ -32,11 +32,14 @@
<a href="/logout"><button class="btn btn-primary logout margin-top">Logout 登出</button></a> <a href="/logout"><button class="btn btn-primary logout margin-top">Logout 登出</button></a>
<a href="/select"><button class="btn btn-primary margin-top logout">Choose Subuser 選擇其他帳號</button></a> <a href="/select"><button class="btn btn-primary margin-top logout">Choose Subuser 選擇其他帳號</button></a>
<select name="date" id="date" class="form-select logout" onchange="chgDate();"> <select name="date" id="date" class="form-select logout" onchange="chgDate();">
{% for date in absData %} {% for date in range(dateKeys|length) %}
{% if date == currDate %} {% if dateKeys[date] == currDate %}
<option value="{{date}}" selected="selected">{{date}}</option> {% if date-2 >= 0 %}<option value="{{dateKeys[date-2]}}">{{dateKeys[date-2]}}</option>{% endif %}
{% else %} {% if date-1 >= 0 %}<option value="{{dateKeys[date-1]}}">{{dateKeys[date-1]}}</option>{% endif %}
<option value="{{date}}">{{date}}</option> <option value="{{dateKeys[date]}}" selected="selected">{{dateKeys[date]}} ★</option>
{% for i in range(1,5) %}
{% if date+i < dateKeys|length %}<option value="{{dateKeys[date+i]}}">{{dateKeys[date+i]}}</option>{%endif%}
{% endfor %}
{% endif %} {% endif %}
{% endfor %} {% endfor %}
</select> </select>

View file

@ -35,13 +35,13 @@
<option value="" selected>Please select</option> <option value="" selected>Please select</option>
{% for key in data %} {% for key in data %}
{% if data[key]['type'] == 'homeroom' %} {% if data[key]['type'] == 'homeroom' %}
<option value="homeroom^{{data[key]['homeroom']}}">HR: {{data[key]['homeroom']}} <option value="homeroom^{{data[key]['homeroom']}}">🏠 {{data[key]['homeroom']}}
</option> </option>
{% else %} {% else %}
{% for i in data[key] %} {% for i in data[key] %}
{% if i == 'type' %} {% if i == 'type' %}
{% else %} {% else %}
<option value="group^{{i}}^{{data[key][i]}}">GP: {{i}}: {{data[key][i]}}</option> <option value="group^{{i}}^{{data[key][i]}}">🧑‍🏫 {{i}}: {{data[key][i]}}</option>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% endif %} {% endif %}