Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
8deefb9035 | |||
4f2984deea | |||
70d2325579 | |||
36d840c752 | |||
4400446718 |
@ -50,7 +50,7 @@
|
|||||||
<div class="d-flex w-100 justify-content-between">
|
<div class="d-flex w-100 justify-content-between">
|
||||||
<h5 class="mb-1">Start Time</h5>
|
<h5 class="mb-1">Start Time</h5>
|
||||||
</div>
|
</div>
|
||||||
{{ entry.start_time.strftime('%d %b %Y %H:%M:%S') }}
|
{{ entry.start_time.strftime('%d %b %Y %H:%M:%S') if entry.start_time else None }}
|
||||||
</li>
|
</li>
|
||||||
<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">
|
||||||
@ -59,7 +59,7 @@
|
|||||||
<span class="badge bg-danger">Late</span>
|
<span class="badge bg-danger">Late</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
{{ entry.end_time.strftime('%d %b %Y %H:%M:%S') }}
|
{{ entry.end_time.strftime('%d %b %Y %H:%M:%S') if entry.end_time else None }}
|
||||||
</li>
|
</li>
|
||||||
<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">
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
<a href="{{ url_for('admin._view_test', id=test.id) }}">{{ test.get_code() }}</a>
|
<a href="{{ url_for('admin._view_test', id=test.id) }}">{{ test.get_code() }}</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{{ test.end_date.strftime('%d %b %Y') }}
|
{{ test.end_date.strftime('%d %b %Y') if test.end_date else None }}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
@ -72,10 +72,14 @@
|
|||||||
<a href="{{ url_for('admin._view_entry', id=result.id) }}">{{ result.get_surname() }}, {{ result.get_first_name() }}</a>
|
<a href="{{ url_for('admin._view_entry', id=result.id) }}">{{ result.get_surname() }}, {{ result.get_first_name() }}</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{{ result.end_time.strftime('%d %b %Y %H:%M') }}
|
{{ result.end_time.strftime('%d %b %Y %H:%M') if result.end_time else None }}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{{ (100*result.result['score']/result.result['max'])|round|int }}% ({{ result.result.grade }})
|
{% if result.result %}
|
||||||
|
{{ (100*result.result['score']/result.result['max'])|round|int }}% ({{ result.result.grade }})
|
||||||
|
{% else %}
|
||||||
|
Incomplete
|
||||||
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
@ -117,7 +121,7 @@
|
|||||||
<a href="{{ url_for('admin._view_test', id=test.id) }}">{{ test.get_code() }}</a>
|
<a href="{{ url_for('admin._view_test', id=test.id) }}">{{ test.get_code() }}</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{{ test.end_date.strftime('%d %b %Y') }}
|
{{ test.end_date.strftime('%d %b %Y') if test.end_date else None }}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
@ -49,7 +49,7 @@
|
|||||||
<div class="d-flex w-100 justify-content-between">
|
<div class="d-flex w-100 justify-content-between">
|
||||||
<h5 class="mb-1">Start Time</h5>
|
<h5 class="mb-1">Start Time</h5>
|
||||||
</div>
|
</div>
|
||||||
{{ entry.start_time.strftime('%d %b %Y %H:%M:%S') }}
|
{{ entry.start_time.strftime('%d %b %Y %H:%M:%S') if entry.start_time else None }}
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<li class="list-group-item list-group-item-action">
|
<li class="list-group-item list-group-item-action">
|
||||||
|
@ -32,13 +32,13 @@
|
|||||||
<div class="d-flex w-100 justify-content-between">
|
<div class="d-flex w-100 justify-content-between">
|
||||||
<h5 class="mb-1">Start Date</h5>
|
<h5 class="mb-1">Start Date</h5>
|
||||||
</div>
|
</div>
|
||||||
{{ test.start_date.strftime('%d %b %Y %H:%M') }}
|
{{ test.start_date.strftime('%d %b %Y %H:%M') if test.start_date else None }}
|
||||||
</li>
|
</li>
|
||||||
<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">Expiry Date</h5>
|
<h5 class="mb-1">Expiry Date</h5>
|
||||||
</div>
|
</div>
|
||||||
{{ test.end_date.strftime('%d %b %Y %H:%M') }}
|
{{ test.end_date.strftime('%d %b %Y %H:%M') if test.end_date else None }}
|
||||||
</li>
|
</li>
|
||||||
<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">
|
||||||
|
@ -10,7 +10,7 @@ from flask import abort, Blueprint, jsonify, render_template, request, send_file
|
|||||||
from flask.helpers import abort, flash, redirect, url_for
|
from flask.helpers import abort, flash, redirect, url_for
|
||||||
from flask_login import current_user, login_required
|
from flask_login import current_user, login_required
|
||||||
|
|
||||||
from datetime import date, datetime, timedelta
|
from datetime import date, datetime, MINYEAR, timedelta
|
||||||
from json import loads
|
from json import loads
|
||||||
from os import path
|
from os import path
|
||||||
import secrets
|
import secrets
|
||||||
@ -34,11 +34,11 @@ def _home():
|
|||||||
write('system.log', f'Database error when processing request \'{request.url}\': {exception}')
|
write('system.log', f'Database error when processing request \'{request.url}\': {exception}')
|
||||||
return abort(500)
|
return abort(500)
|
||||||
current_tests = [ test for test in tests if test.end_date >= datetime.now() and test.start_date.date() <= date.today() ]
|
current_tests = [ test for test in tests if test.end_date >= datetime.now() and test.start_date.date() <= date.today() ]
|
||||||
current_tests.sort(key= lambda x: x.end_date, reverse=True)
|
current_tests.sort(key= lambda x: x.end_date or datetime(MINYEAR,1,1), reverse=True)
|
||||||
upcoming_tests = [ test for test in tests if test.start_date.date() > datetime.now().date()]
|
upcoming_tests = [ test for test in tests if test.start_date.date() > datetime.now().date()]
|
||||||
upcoming_tests.sort(key= lambda x: x.start_date)
|
upcoming_tests.sort(key= lambda x: x.start_date or datetime(MINYEAR,1,1))
|
||||||
recent_results = [result for result in results if not result.status == 'started' ]
|
recent_results = [result for result in results if not result.status == 'started' ]
|
||||||
recent_results.sort(key= lambda x: x.end_time, reverse=True)
|
recent_results.sort(key= lambda x: x.end_time or datetime(MINYEAR,1,1), reverse=True)
|
||||||
return render_template('/admin/index.html', current_tests = current_tests, upcomimg_tests = upcoming_tests, recent_results = recent_results)
|
return render_template('/admin/index.html', current_tests = current_tests, upcomimg_tests = upcoming_tests, recent_results = recent_results)
|
||||||
|
|
||||||
@admin.route('/settings/')
|
@admin.route('/settings/')
|
||||||
@ -309,7 +309,7 @@ def _tests(filter:str=None):
|
|||||||
if filter in [None, '', 'active']:
|
if filter in [None, '', 'active']:
|
||||||
tests = [ test for test in _tests if test.end_date >= now and test.start_date <= now ]
|
tests = [ test for test in _tests if test.end_date >= now and test.start_date <= now ]
|
||||||
display_title = 'Active Exams'
|
display_title = 'Active Exams'
|
||||||
error_none = 'There are no exams that are currently active. You can create one using the Creat Exam form.'
|
error_none = 'There are no exams that are currently active. You can create one using the Create Exam form.'
|
||||||
if filter == 'expired':
|
if filter == 'expired':
|
||||||
tests = [ test for test in _tests if test.end_date < now ]
|
tests = [ test for test in _tests if test.end_date < now ]
|
||||||
display_title = 'Expired Exams'
|
display_title = 'Expired Exams'
|
||||||
|
Reference in New Issue
Block a user