From: Guillaume Pellerin Date: Tue, 14 Jul 2015 17:07:53 +0000 (+0200) Subject: fix period for score list X-Git-Tag: 1.1~216 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=f2f9c8639a720bfd7508e694011c73e2487862d7;p=teleforma.git fix period for score list --- diff --git a/teleforma/exam/views.py b/teleforma/exam/views.py index 979877a9..83645477 100644 --- a/teleforma/exam/views.py +++ b/teleforma/exam/views.py @@ -229,9 +229,10 @@ class ScriptsScoreAllView(ScriptsTreatedView): def get_context_data(self, **kwargs): context = super(ScriptsScoreAllView, self).get_context_data(**kwargs) + period = Period.objects.get(id=self.kwargs['period_id']) if self.request.user.is_staff or self.request.user.professor.all(): - scripts = Script.objects.all().exclude(score=None) + scripts = Script.objects.filter(period=period).exclude(score=None) else: scripts = self.get_queryset() @@ -252,14 +253,14 @@ class ScriptsScoreAllView(ScriptsTreatedView): data = [] for session in sessions: - scripts = Script.objects.filter(session=session).exclude(score=None) + scripts = Script.objects.filter(session=session, period=period).exclude(score=None) data.append(np.mean([s.score for s in scripts])) scores.append({'name': 'Moyenne generale', 'data': data}) for script_type in ScriptType.objects.all(): data = [] for session in sessions: - scripts = Script.objects.filter(session=session, type=script_type).exclude(score=None) + scripts = Script.objects.filter(session=session, period=period, type=script_type).exclude(score=None) data.append(np.mean([s.score for s in scripts])) scores.append({'name': 'Moyenne ' + script_type.name, 'data': data}) @@ -273,9 +274,10 @@ class ScriptsScoreCourseView(ScriptsScoreAllView): def get_context_data(self, **kwargs): context = super(ScriptsScoreCourseView, self).get_context_data(**kwargs) course = Course.objects.get(id=self.kwargs['course_id']) + period = Period.objects.get(id=self.kwargs['period_id']) if self.request.user.is_staff or self.request.user.professor.all(): - scripts = Script.objects.all().filter(course=course).exclude(score=None) + scripts = Script.objects.all().filter(course=course, period=period).exclude(score=None) else: scripts = self.get_queryset().filter(course=course) @@ -296,14 +298,14 @@ class ScriptsScoreCourseView(ScriptsScoreAllView): data = [] for session in sessions: - scripts = Script.objects.filter(session=session, course=course).exclude(score=None) + scripts = Script.objects.filter(session=session, course=course, period=period).exclude(score=None) data.append(np.mean([s.score for s in scripts])) scores.append({'name':'Moyenne generale', 'data': data}) for script_type in ScriptType.objects.all(): data = [] for session in sessions: - scripts = Script.objects.filter(session=session, type=script_type, course=course).exclude(score=None) + scripts = Script.objects.filter(session=session, type=script_type, course=course, period=period).exclude(score=None) data.append(np.mean([s.score for s in scripts])) scores.append({'name': 'Moyenne ' + script_type.name, 'data': data}) diff --git a/teleforma/templates/telemeta/base.html b/teleforma/templates/telemeta/base.html index 9cf52162..bb8baf38 100644 --- a/teleforma/templates/telemeta/base.html +++ b/teleforma/templates/telemeta/base.html @@ -142,18 +142,14 @@ alt="logo" /> {% endif %} {% if user.is_authenticated %} - {% if user.is_staff %} + {% if user.is_superuser %}
  • {% trans "Admin" %}
  • {% else %}
  • {% trans "Help" %}
  • {% endif %} -
  • {% if user.first_name and user.last_name %} - {{ user.first_name }} {{ user.last_name }} - {% else %} - {{ user.username }} - {% endif %} +
  • + {% if user.first_name and user.last_name %}{{ user.first_name }} {{ user.last_name }}{% else %}{{ user.username }}{% endif %}