]> git.parisson.com Git - teleforma.git/commitdiff
students were able to add new copy to synthesis note despite not being allowed to
authorYoan Le Clanche <yoanl@pilotsystems.net>
Fri, 1 Feb 2019 08:59:37 +0000 (09:59 +0100)
committerYoan Le Clanche <yoanl@pilotsystems.net>
Fri, 1 Feb 2019 08:59:37 +0000 (09:59 +0100)
teleforma/views/crfpa.py

index 6d4c281058e64cafb342593b488ba9ad0edb119a..e3f93a5c4494212d324bfa894f469ffe45549df5 100644 (file)
@@ -91,19 +91,19 @@ def get_crfpa_courses(user, date_order=False, num_order=False, period=None):
                                types=s_courses[course])
 
         synthesis_note = training.synthesis_note
-        if synthesis_note:
+        if synthesis_note.count():
             courses = format_courses(courses,
                             queryset=Course.objects.filter(synthesis_note=True),
                             types=synthesis_note)
 
         obligation = training.obligation
-        if obligation:
+        if obligation.count():
             courses = format_courses(courses,
                             queryset=Course.objects.filter(obligation=True),
                             types=obligation)
 
         magistral = training.magistral
-        if magistral:
+        if magistral.count():
             courses = format_courses(courses,
                             queryset=Course.objects.filter(magistral=True),
                             types=magistral)