courses = [ c for c in courses if c.has_exam_scripts ]
         courses = [ c for c in courses if c.is_for_period(self.period) ]
         return [ c.id for c in courses ]
-        
+
     def get_context_data(self, **kwargs):
         context = super(ScriptMixinView, self).get_context_data(**kwargs)
         self.period = Period.objects.get(id=self.kwargs['period_id'])
         if platform_only:
             QT &= Q(author__student__platform_only = int(platform_only))
         return QT
- 
+
     def get_base_queryset(self):
         QT = self.get_form_queryset() & Q(period_id=self.kwargs['period_id'])
         if self.status_filter:
 
     def get_queryset(self):
         qs = super(ScriptsPendingView, self).get_queryset()
-        
+
         if self.request.GET.get('corrector') is None:
             user = self.request.user
             # Exclude status=2 but not author=user
 class ScriptsTreatedView(ScriptsView):
 
     status_filter = (4, 5 ,7)
-    
+
     def get_context_data(self, **kwargs):
         context = super(ScriptsTreatedView, self).get_context_data(**kwargs)
         period = Period.objects.get(id=self.kwargs['period_id'])
         messages.error(self.request, _("There was a problem with your submission. Please try again, later if possible."))
         return super(ScriptCreateView, self).form_invalid(form)
 
-    def get_context_data(self, **kwargs):    
+    def get_context_data(self, **kwargs):
         context = super(ScriptCreateView, self).get_context_data(**kwargs)
         context['create_fields'] = ['course', 'session', 'file' ]
         context['form'].fields['course'].queryset = context['courses']
 class ScriptsScoreAllView(ScriptsTreatedView):
 
     perso_name = 'Moyenne personnelle'
-    
+
     template_name='exam/scores.html'
 
     def score_data_setup(self, x, y):
         context = super(ScriptsScoreAllView, self).get_context_data(**kwargs)
         user = self.request.user
         period_id = self.kwargs['period_id']
-        
+
         if 'course_id' in self.kwargs:
             course = Course.objects.get(id=self.kwargs['course_id'])
         else:
         if course:
             scripts = scripts.filter(course=course)
             all_scripts = all_scripts.filter(course=course)
-            
+
         sessions = set()
         scores = []
 
             res = { s: [] for s in sessions }
             for script in scripts.values('score', 'session'):
                 if script['session'] in res:
-                    res[script['session']].append(script['score'])
+                    if script['score']:
+                        res[script['session']].append(script['score'])
             return [ np.mean(res[s]) for s in sessions ]
-        
+
         if not staff_or_teacher:
             scores.append({'name': self.perso_name,
                            'data': by_session(scripts)})
-            
+
         scores.append({'name': 'Moyenne generale',
                        'data': by_session(all_scripts)})
 
         for script_type in ScriptType.objects.all():
             scripts = all_scripts.filter(type=script_type)
-            scores.append({'name': 'Moyenne ' + script_type.name, 
+            scores.append({'name': 'Moyenne ' + script_type.name,
                            'data': by_session(scripts)})
 
         context['data'] = self.score_data_setup(sessions_x, scores)
                                         session = session,
                                         course_id = course_id).values('author_id')
         scripts = set([s['author_id'] for s in scripts])
-        
-        students = students.exclude(user_id__in = scripts)            
+
+        students = students.exclude(user_id__in = scripts)
 
         res = []
         for student in students:
            user = student.user
            # FIXME : Filter those who access the course, but that's very slow,
-           # so I disable it for now - we'll see if we can do that faster later    
+           # so I disable it for now - we'll see if we can do that faster later
            # courses = get_courses(user)
            # if course_id in [ c['course'].id for c in courses ]:
            res.append({ 'id': user.id,
                         'name': str(user) })
-        
+
         return res
 
     def form_valid(self, form):
                          session = session,
                          author_id = student,
                          type = sc_type,
-                         score = score,                                 
+                         score = score,
                          status = 7)
             obj.save()