Skip to content

Commit 37934cb

Browse files
prem-2006hwatheod
andauthored
fix(lottery): cast priority index to int in get_computed_schedule (learning-unlimited#4768)
* fix(lottery): cast priority index to int in get_computed_schedule fixes learning-unlimited#4759 * fix(lottery): use raw string for regex in get_computed_schedule fixes learning-unlimited#4759 --------- Co-authored-by: hwatheod <ted@learningu.org>
1 parent d18e71c commit 37934cb

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

esp/esp/program/controllers/lottery.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -690,9 +690,9 @@ def get_computed_schedule(self, student_id, mode='assigned'):
690690
assignments = numpy.nonzero(self.priority[1][self.student_indices[student_id],:])[0]
691691
else:
692692
import re
693-
p = re.search('(?<=priority_)\d*', mode).group(0)
693+
p = re.search(r'(?<=priority_)\d*', mode).group(0)
694694
if p:
695-
assignments = numpy.nonzero(self.priority[p][self.student_indices[student_id],:])[0]
695+
assignments = numpy.nonzero(self.priority[int(p)][self.student_indices[student_id],:])[0]
696696
result = []
697697
for i in range(assignments.shape[0]):
698698
result.append(ClassSection.objects.get(id=self.section_ids[assignments[i]]))

0 commit comments

Comments
 (0)