Skip to content
Snippets Groups Projects
Commit d690fd2f authored by Odin Johan Vatne's avatar Odin Johan Vatne
Browse files

Improve accepted offer automation

parent fa7e26d2
No related branches found
No related tags found
No related merge requests found
......@@ -23,18 +23,20 @@ def get_next(request, fallback='/'):
def student_accepted(application):
student = application.student
student_accepted_recur(student, application, True)
student_accepted_helper(student)
group_students = application.group_members.all()
for groupmate in group_students:
student_accepted_helper(groupmate)
def student_accepted_recur(student, application, allowRecursion = False):
def student_accepted_helper(student):
other_applications = Application.objects.filter(student=student).exclude(student_status='ACC')
for app in other_applications:
app.student_status = 'RETR' if app.professor_status != 'OFFR' else 'DECL'
app.priority = None
app.save()
if allowRecursion:
group_students = application.group_members.all()
for groupmate in group_students:
student_accepted_recur(groupmate, application)
other_member_applications = student.member_projects.exclude(student_status='ACC')
for app in other_member_applications:
app.group_members.remove(student)
def project_closed(project):
open_applications = Application.objects.filter(project=project).exclude(student_status='ACC')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment