+ def competition_link(self):
+ return reverse('form_single', kwargs={'submission_id': self.id, 'key': self.key})
+
+ def get_answers(self):
+ return json.loads(self.answers) if self.answers else {}
+
+ def shuffled_exercise_ids(self):
+ exercise_ids = [e['id'] for e in exercises]
+ seeded_random = random.Random(self.random_seed)
+ seeded_random.shuffle(exercise_ids)
+ return exercise_ids
+
+ def current_exercise(self):
+ answers = self.get_answers()
+ for i, id in enumerate(self.shuffled_exercise_ids(), 1):
+ if str(id) not in answers:
+ return i, get_exercise_by_id(id)
+ return None, None
+