- for result in sorted(self.results, key=lambda r: dec_or_0(r[4]), reverse=True):
- if options['only_to'] and result[3] != options['only_to']:
+ sorted_results = sorted(self.results, key=lambda r: dec_or_0(r[3]), reverse=True)
+ for email, last_name, first_name, final_result in sorted_results:
+ submission = Submission.objects.get(email=email)
+ teacher_email = submission.contact.contact
+ if options['only_to'] and teacher_email != options['only_to']: