Example #1
0
def scores_responsible_management(request):
    context = {
        'course_code': request.GET.get('course_code'),
        'learning_unit_title': request.GET.get('learning_unit_title'),
        'tutor': request.GET.get('tutor'),
        'scores_responsible': request.GET.get('scores_responsible')
    }
    learning_unit_year_id = request.GET.get('learning_unit_year').strip('learning_unit_year_')
    attributions_data = get_attributions_data(request.user, learning_unit_year_id, '-score_responsible')
    context.update(attributions_data)
    return render(request, 'scores_responsible_edit.html', context)
Example #2
0
def edit(request):
    context = {
        'course_code': request.GET.get('course_code'),
        'learning_unit_title': request.GET.get('learning_unit_title'),
        'tutor': request.GET.get('tutor'),
        'summary_responsible': request.GET.get('summary_responsible')
    }
    learning_unit_year_id = request.GET.get('learning_unit_year').strip('learning_unit_year_')
    attributions_data = get_attributions_data(request.user, learning_unit_year_id)
    context.update(attributions_data)
    return render(request, 'summary_responsible_edit.html', context)
Example #3
0
def edit(request):
    context = {
        'course_code': request.GET.get('course_code'),
        'learning_unit_title': request.GET.get('learning_unit_title'),
        'tutor': request.GET.get('tutor'),
        'summary_responsible': request.GET.get('summary_responsible')
    }
    learning_unit_year_id = request.GET.get('learning_unit_year').strip(
        'learning_unit_year_')
    attributions_data = get_attributions_data(request.user,
                                              learning_unit_year_id)
    context.update(attributions_data)
    return layout.render(request, 'summary_responsible_edit.html', context)
Example #4
0
    def test_get_attributions_data(self, mock_find_all_responsible,
                                   mock_get_learning_unit):
        learning_unit_year = LearningUnitYearFactory()
        mock_get_learning_unit.return_value = learning_unit_year
        mock_find_all_responsible.return_value = []

        expected_result = {
            'learning_unit_year': learning_unit_year,
            'attributions': [],
            'academic_year': learning_unit_year.academic_year
        }
        result = summary_responsible.get_attributions_data(
            user=UserFactory(), learning_unit_year_id=learning_unit_year.id)
        self.assertIsInstance(result, dict)
        self.assertDictEqual(result, expected_result)
    def test_get_attributions_data(self, mock_find_all_responsible, mock_get_learning_unit):
        learning_unit_year = LearningUnitYearFactory()
        mock_get_learning_unit.return_value = learning_unit_year
        mock_find_all_responsible.return_value = []

        expected_result = {
            'learning_unit_year': learning_unit_year,
            'attributions': [],
            'academic_year': learning_unit_year.academic_year
        }
        result = summary_responsible.get_attributions_data(
            user=UserFactory(),
            learning_unit_year_id=learning_unit_year.id
        )
        self.assertIsInstance(result, dict)
        self.assertDictEqual(result, expected_result)