Example #1
0
 def test_find_by_offer_year(self):
     tmp_student = StudentFactory()
     tmp_offer_year = OfferYearFactory()
     OfferEnrollmentFactory.create(offer_year=tmp_offer_year, student=tmp_student)
     db_student = list(student.find_by_offer_year([tmp_offer_year][0]))[0]
     self.assertIsNotNone(db_student)
     self.assertEqual(db_student, tmp_student)
Example #2
0
def get_students_list_in_offer_year(request, offer_year_start_id):
    offer_year_start = get_object_or_404(OfferYear, pk=offer_year_start_id)
    students_list = find_by_offer_year(offer_year_start)
    data = []
    if students_list:
        for student in students_list:
            data.append({
                'person_id': student.id,
                'first_name': student.person.first_name,
                'last_name': student.person.last_name,
                'registration_id': student.registration_id
            })

    else:
        data = False

    return JsonResponse({'res': data})