diff --git a/ref-test/app/admin/views.py b/ref-test/app/admin/views.py index 02030da..65bb6f2 100644 --- a/ref-test/app/admin/views.py +++ b/ref-test/app/admin/views.py @@ -291,7 +291,7 @@ def _create_test(): new_test.start_date = datetime.strptime(new_test.start_date, '%Y-%m-%dT%H:%M') new_test.end_date = request.form.get('expiry_date') new_test.end_date = datetime.strptime(new_test.end_date, '%Y-%m-%dT%H:%M') - new_test.time_limit = request.form.get('time_limit') + new_test.time_limit = None if request.form.get('time_limit') == 'none' else int(request.form.get('time_limit')) dataset = request.form.get('dataset') new_test.dataset = Dataset.query.filter_by(id=dataset).first() success, message = new_test.create() diff --git a/ref-test/app/models/entry.py b/ref-test/app/models/entry.py index 557003a..c1adfb6 100644 --- a/ref-test/app/models/entry.py +++ b/ref-test/app/models/entry.py @@ -86,7 +86,7 @@ class Entry(db.Model): self.answers = answers self.result = result write('tests.log', f'Test completed by {self.get_first_name()} {self.get_surname()}.') - delta = timedelta(minutes=self.test.time_limit+1) + delta = timedelta(minutes=int(0 if self.test.time_limit is None else self.test.time_limit)+1) if not self.test.time_limit or self.end_time <= self.start_time + delta: self.status = 'completed' self.valid = True