Skip to content
This repository was archived by the owner on Sep 23, 2024. It is now read-only.

Commit 29320f5

Browse files
committed
Use constant for max training minutes
1 parent b769421 commit 29320f5

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

server/app_engine.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,7 @@ def monitor_training():
579579
@login_required
580580
@roles_accepted(roles.Role.GLOBAL_ADMIN, roles.Role.ML_DEVELOPER)
581581
def admin():
582-
return flask.render_template('admin.html', config=config.config)
582+
return flask.render_template('admin.html', config=config.config, max_mins=team_info.TOTAL_TRAINING_MINUTES_PER_TEAM)
583583

584584

585585
@app.route('/refreshConfig', methods=['POST'])
@@ -1507,7 +1507,7 @@ def resources():
15071507
def reset_remaining_training_minutes():
15081508
data = validate_keys(flask.request.form.to_dict(flat=True),
15091509
['reset_minutes', 'date_time_string'])
1510-
reset_minutes = validate_int(data.get('reset_minutes'), min=1, max=240)
1510+
reset_minutes = validate_int(data.get('reset_minutes'), min=1, max=team_info.TOTAL_TRAINING_MINUTES_PER_TEAM)
15111511
action_parameters = action.create_action_parameters(
15121512
'', action.ACTION_NAME_RESET_REMAINING_TRAINING_MINUTES)
15131513
action_parameters['reset_minutes'] = reset_minutes

server/templates/admin.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
<div class="container">
2222
<h2>Reset all teams' remaining_training_minutes</h2>
2323
<label for="resetInput" class="text-18">Reset to:</label>&nbsp;
24-
<input id="resetInput" type="number" class="text-18 rightText" value="240"
25-
min="1" max="240" style="width: 7ch">
24+
<input id="resetInput" type="number" class="text-18 rightText" value="{{max_mins}}"
25+
min="1" max="{{max_mins}}" style="width: 7ch">
2626
<br>
2727
<button id="resetButton" class="btn btn-secondary">Reset</button>
2828
<div id="resetResponse"></div>
@@ -42,7 +42,7 @@ <h2>Reset all teams' remaining_training_minutes</h2>
4242
<h2>Increment all teams' remaining_training_minutes</h2>
4343
<label for="incrementInput" class="text-18">Increment by:</label>&nbsp;
4444
<input id="incrementInput" type="number" class="text-18 rightText" value="60"
45-
min="1" max="240" style="width: 7ch">
45+
min="1" max="{{max_mins}}" style="width: 7ch">
4646
<br>
4747
<button id="incrementButton" class="btn btn-secondary">Increment</button>
4848
<div id="incrementResponse"></div>

0 commit comments

Comments
 (0)