def find_by_learning_unit(learning_unit_year): """ :param learning_unit_year: :return: All tutors of the learningUnit passed in parameter. """ if isinstance(learning_unit_year, list): queryset = attribution.search(list_learning_unit_year=learning_unit_year) else: queryset = attribution.search(learning_unit_year=learning_unit_year) tutor_ids = queryset.values_list('tutor').distinct('tutor') return Tutor.objects.filter(pk__in=tutor_ids)\ .select_related('person')\ .order_by('person__last_name', 'person__first_name')
def test_search(self): attributions = attribution.search( tutor=self.tutor, learning_unit_year=self.learning_unit_year, score_responsible=True, list_learning_unit_year=None) self.assertEqual(attributions[0].tutor, self.tutor)
def _get_summary_detail(a_calendar, cms_list, entity_learning_unit_yr_list_param): entity_learning_unit_yr_list = entity_learning_unit_yr_list_param for lu in entity_learning_unit_yr_list: lu.summary_responsibles = attribution.search(summary_responsible=True, learning_unit_year=lu) lu.summary_status = _get_summary_status(a_calendar, cms_list, lu) return entity_learning_unit_yr_list
def _find_related_attribution(score_encoding_progress_list): learning_units = [ score_encoding_progress.learning_unit_year_id for score_encoding_progress in score_encoding_progress_list ] return attribution.search(list_learning_unit_year=learning_units)\ .order_by('tutor__person__last_name', 'tutor__person__first_name')
def test_search(self): attributions = attribution.search(tutor=self.tutor, learning_unit_year=self.learning_unit_year, score_responsible=True, list_learning_unit_year=None) self.assertEqual(attributions[0].tutor, self.tutor)
def _find_related_attribution(score_encoding_progress_list): learning_units = [score_encoding_progress.learning_unit_year_id for score_encoding_progress in score_encoding_progress_list] return attribution.search(list_learning_unit_year=learning_units)\ .order_by('tutor__person__last_name', 'tutor__person__first_name')