Skip to content

Commit

Permalink
Assign new students to first project of client side course
Browse files Browse the repository at this point in the history
  • Loading branch information
stevebrownlee committed May 14, 2024
1 parent a96f54a commit 7dde170
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions LearningAPI/views/profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,22 @@ def list(self, request):
nss_user.save()

if cohort is not None:
coh = Cohort.objects.get(pk=cohort)
# First time authenticating with Github, so add user to cohort
cohort_assignment = Cohort.objects.get(pk=cohort)
usercohort = NssUserCohort()
usercohort.cohort = coh
usercohort.cohort = cohort_assignment
usercohort.nss_user = nss_user
usercohort.save()

# Assign student to first project in cohort's course
cohort_first_course = cohort_assignment.courses.get(index=0)
course_first_book = cohort_first_course.course.books.get(index=0)
book_first_project = course_first_book.projects.get(index=0)
student_project = StudentProject()
student_project.student = nss_user
student_project.project = book_first_project
student_project.save()

try:
personality = StudentPersonality.objects.get(student=nss_user)
except StudentPersonality.DoesNotExist:
Expand Down

0 comments on commit 7dde170

Please sign in to comment.