Skip to content

Commit

Permalink
Merge pull request #442 from uclouvain/hotfix/INTERNSHIP-329
Browse files Browse the repository at this point in the history
INTERNSHIP-329 use position to balance internships assignment reparti…
  • Loading branch information
mathieuzen authored Oct 14, 2024
2 parents e04a250 + bf768f6 commit 3d56901
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions business/assignment.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def _assign_students_in_subcohorts(self):
# shuffle interships, keeps on top specialties that are not available in all cohorts to prioritize on these
internships = sorted(
available_internships,
key=lambda i: (self.internships_availability_occurence[i], random.random())
key=lambda i: (self.internships_availability_occurence[i], i.position, random.random())
)
for internship in internships:
_assign_student(self, student, internship)
Expand Down Expand Up @@ -423,7 +423,9 @@ def _assign_student(assignment, student, internship):
affectations = assign_choices_to_student(assignment, student, choices, internship)
# Deal with internship at choice
else:
if isinstance(internship, Iterable) and not _has_affected_non_mandatory_internship(student_affectations):
if not _has_affected_non_mandatory_internship(student_affectations):
if not isinstance(internship, Iterable):
internship = [internship]
for chosen_internship in internship:
if affectations is None or affectations == []:
last = chosen_internship == list(internship)[:-1]
Expand Down

0 comments on commit 3d56901

Please sign in to comment.