Bug fix and data persistence

This commit is contained in:
Vivek Santayana 2021-12-07 15:52:58 +00:00
parent f144097c5d
commit 2038965dcb
3 changed files with 13 additions and 9 deletions

View File

@ -28,6 +28,7 @@ services:
- 5000 - 5000
volumes: volumes:
- ./.security:/ref-test/.security - ./.security:/ref-test/.security
- ./ref-test/data:/ref-test/data
restart: unless-stopped restart: unless-stopped
networks: networks:
- frontend - frontend

View File

@ -44,12 +44,14 @@
{{ entry.user_code }} {{ entry.user_code }}
</li> </li>
{% endif %} {% endif %}
<li class="list-group-item list-group-item-action"> {% if 'start_time' in entry %}
<div class="d-flex w-100 justify-content-between"> <li class="list-group-item list-group-item-action">
<h5 class="mb-1">Start Time</h5> <div class="d-flex w-100 justify-content-between">
</div> <h5 class="mb-1">Start Time</h5>
{{ entry.start_time.strftime('%d %b %Y %H:%M:%S') }} </div>
</li> {{ entry.start_time.strftime('%d %b %Y %H:%M:%S') }}
</li>
{% endif %}
<li class="list-group-item list-group-item-action"> <li class="list-group-item list-group-item-action">
<div class="d-flex w-100 justify-content-between"> <div class="d-flex w-100 justify-content-between">
<h5 class="mb-1">Submission Time</h5> <h5 class="mb-1">Submission Time</h5>

View File

@ -143,9 +143,10 @@ def submit_quiz():
if not entry: if not entry:
return jsonify('Unrecognised ID', 'error'), 400 return jsonify('Unrecognised ID', 'error'), 400
status = 'submitted' status = 'submitted'
if entry['end_time']: if 'end_time' in entry:
if datetime.utcnow() > entry['end_time'] + timedelta(minutes=2): if entry['end_time']:
status = 'late' if datetime.utcnow() > entry['end_time'] + timedelta(minutes=2):
status = 'late'
test_code = entry['test_code'] test_code = entry['test_code']
test = db.tests.find_one({'test_code' : test_code}) test = db.tests.find_one({'test_code' : test_code})
dataset = test['dataset'] dataset = test['dataset']