Example #1
0
def scores_responsible_search(request):
    entities_manager = mdl_base.entity_manager.find_by_user(request.user)
    academic_year = mdl_base.academic_year.current_academic_year()
    _append_entity_version(entities_manager, academic_year)

    if request.GET:
        entities_with_descendants = find_entities_with_descendants_from_entity_managers(
            entities_manager)
        attributions = list(
            mdl_attr.attribution.search_scores_responsible(
                learning_unit_title=request.GET.get('learning_unit_title'),
                course_code=request.GET.get('course_code'),
                entities=entities_with_descendants,
                tutor=request.GET.get('tutor'),
                responsible=request.GET.get('scores_responsible')))
        dict_attribution = get_attributions_list(attributions,
                                                 "-score_responsible")
        return render(
            request, 'scores_responsible.html', {
                "entities_manager": entities_manager,
                "academic_year": academic_year,
                "dict_attribution": dict_attribution,
                "learning_unit_title": request.GET.get('learning_unit_title'),
                "course_code": request.GET.get('course_code'),
                "tutor": request.GET.get('tutor'),
                "scores_responsible": request.GET.get('scores_responsible'),
                "init": "1"
            })
    else:
        return render(
            request, 'scores_responsible.html', {
                "entities_manager": entities_manager,
                "academic_year": academic_year,
                "init": "0"
            })
Example #2
0
def search(request):
    entities_manager = mdl_base.entity_manager.find_by_user(request.user)
    # The academic year for summary responsible is the next of current academic year
    academic_year = mdl_base.academic_year.current_academic_year().next()
    _append_entity_version(entities_manager, academic_year)
    context = {"entities_manager": entities_manager, "academic_year": academic_year, "init": "0"}
    if request.GET:
        tutor = request.GET.get('tutor')
        summary_responsible = request.GET.get('summary_responsible')
        course_code = request.GET.get('course_code')
        learning_unit_title = request.GET.get('learning_unit_title')
        attributions = search_attributions(
            entities_manager=entities_manager,
            tutor=tutor,
            summary_responsible=summary_responsible,
            course_code=course_code,
            learning_unit_title=learning_unit_title,
            academic_year=academic_year,
        )
        context.update({
            "dict_attribution": get_attributions_list(attributions, "-summary_responsible"),
            "learning_unit_title": learning_unit_title,
            "course_code": course_code,
            "tutor": tutor,
            "summary_responsible": summary_responsible,
            "init": "1"
        })
    return render(request, 'summary_responsible.html', context)
Example #3
0
def scores_responsible_search(request):
    entities_manager = mdl_base.entity_manager.find_by_user(request.user)
    academic_year = mdl_base.academic_year.current_academic_year()
    _append_entity_version(entities_manager, academic_year)

    if request.GET:
        entities_with_descendants = find_entities_with_descendants_from_entity_managers(entities_manager)
        attributions = list(mdl_attr.attribution.search_scores_responsible(
            learning_unit_title=request.GET.get('learning_unit_title'),
            course_code=request.GET.get('course_code'),
            entities=entities_with_descendants,
            tutor=request.GET.get('tutor'),
            responsible=request.GET.get('scores_responsible')
        ))
        dict_attribution = get_attributions_list(attributions, "-score_responsible")
        return render(request, 'scores_responsible.html', {"entities_manager": entities_manager,
                                                           "academic_year": academic_year,
                                                           "dict_attribution": dict_attribution,
                                                           "learning_unit_title": request.GET.get(
                                                               'learning_unit_title'),
                                                           "course_code": request.GET.get('course_code'),
                                                           "tutor": request.GET.get('tutor'),
                                                           "scores_responsible": request.GET.get('scores_responsible'),
                                                           "init": "1"})
    else:
        return render(request, 'scores_responsible.html', {"entities_manager": entities_manager,
                                                           "academic_year": academic_year,
                                                           "init": "0"})
Example #4
0
 def test_create_attributions_list(self):
     entities_manager = mdl_base.entity_manager.find_by_user(self.user)
     entities = [entity_manager.entity for entity_manager in entities_manager]
     entities_with_descendants = mdl_base.entity.find_descendants(entities)
     attributions_searched = attribution.search_scores_responsible(learning_unit_title=None,
                                                                   course_code=None,
                                                                   entities=entities_with_descendants,
                                                                   tutor=None,
                                                                   responsible=None)
     dictionary = get_attributions_list(attributions_searched, "-score_responsible")
     self.assertIsNotNone(dictionary)
 def test_create_attributions_list(self):
     entities_manager = mdl_base.entity_manager.find_by_user(self.user)
     entities = [entity_manager.entity for entity_manager in entities_manager]
     entities_with_descendants = Entity.objects.filter(
         pk__in=[row['entity_id'] for row in EntityVersion.objects.get_tree(entities)])
     attributions_searched = attribution.search_scores_responsible(
         learning_unit_title=None,
         course_code=None,
         entities=entities_with_descendants,
         tutor=None,
         responsible=None
     )
     dictionary = get_attributions_list(attributions_searched, "-score_responsible")
     self.assertIsNotNone(dictionary)
 def test_create_attributions_list(self):
     entities_manager = mdl_base.entity_manager.find_by_user(self.user)
     entities = [entity_manager.entity for entity_manager in entities_manager]
     entities_with_descendants = Entity.objects.filter(
         pk__in=[row['entity_id'] for row in EntityVersion.objects.get_tree(entities)])
     attributions_searched = attribution.search_scores_responsible(
         learning_unit_title=None,
         course_code=None,
         entities=entities_with_descendants,
         tutor=None,
         responsible=None
     )
     dictionary = get_attributions_list(attributions_searched, "-score_responsible")
     self.assertIsNotNone(dictionary)