Compare commits

..

No commits in common. "36d840c752ff4633bd8a45360b169b06b53c2537" and "adead30a771941964c07990b371e44e9d08fb474" have entirely different histories.

View File

@ -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 or datetime.datetime(datetime.MINYEAR,1,1), reverse=True) current_tests.sort(key= lambda x: x.end_date, 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 or datetime.datetime(datetime.MINYEAR,1,1)) upcoming_tests.sort(key= lambda x: x.start_date)
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 or datetime.datetime(datetime.MINYEAR,1,1), reverse=True) recent_results.sort(key= lambda x: x.end_time, 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 Create Exam form.' error_none = 'There are no exams that are currently active. You can create one using the Creat 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'