Beispiel #1
0
    def __init__(self, id_etudiant):
        Chart.__init__(self)
        self.etudiants = Etudiant.objects.filter(
            user__date_joined__gte=rentree_scolaire()).values(
                'user', 'user__last_name', 'user__first_name')
        self.etudiant_note = Etudiant.objects.filter(user=id_etudiant).values(
            'user', 'user__last_name', 'user__first_name')
        notes_glob = Note.objects.filter(etudiant=id_etudiant).exclude(value=9).exclude(competence=0)\
            .values('competence__famille__nom').annotate(moyenne=Round(Avg('value'),2))\
            .order_by('competence__famille__nom')
        notes_glob_classe = Note.objects.filter(etudiant__user__date_joined__gte=rentree_scolaire()).exclude(value=9).exclude(competence=0)\
            .values('competence__famille__nom').annotate(moyenne=Round(Avg('value'),2))\
            .order_by('competence__famille__nom')

        self.liste_label = []
        self.notes_eleve = []
        self.notes_classe = []

        for note in notes_glob_classe:
            self.liste_label.append(note['competence__famille__nom'])
            self.notes_classe.append(note['moyenne'])

        index = 0

        for note in notes_glob:
            while note['competence__famille__nom'] != self.liste_label[index]:
                self.notes_eleve.append(0)
                index += 1
            self.notes_eleve.append(note['moyenne'])
            index += 1
Beispiel #2
0
 def __init__(self, etudiant,competence):
     Chart.__init__(self)
     notes_eleve=Note.objects.filter(competence=competence).filter(etudiant=etudiant).values('ds__date','ds','numero','value')
     self.liste_note=[]
     self.liste_date=[]
     for note in notes_eleve:
         self.liste_note.append(note['value'])
         self.liste_date.append(str(note['ds__date'])+' ('+str(note['numero'])+')')
     self.nom_dataset=competence.nom
Beispiel #3
0
    def __init__(self, id_etudiant):
        Chart.__init__(self)
        self.etudiants = Etudiant.objects.filter(
            user__date_joined__gte=rentree_scolaire()).values(
                'user', 'user__last_name', 'user__first_name')
        self.etudiant_note = Etudiant.objects.filter(user=id_etudiant).values(
            'user', 'user__last_name', 'user__first_name')
        notes = Note.objects.filter(etudiant__user=id_etudiant).exclude(value=9).exclude(competence=0)\
            .values('competence', 'competence__famille', 'competence__nom', 'competence__reference', 'competence__famille__nom')\
            .annotate(moyenne=Round(Avg('value'),2)).order_by('competence')
        notes_toute_classe = Note.objects.filter(etudiant__user__date_joined__gte=rentree_scolaire())\
            .exclude(value=9).exclude(competence=0).values('competence', 'competence__famille', 'competence__nom', 'competence__reference', 'competence__famille__nom')\
            .annotate(moyenne=Round(Avg('value'),2)).order_by('competence')
        self.liste_label = []
        self.liste_comp = []
        self.notes_eleve = []
        self.notes_classe = []

        for note in notes_toute_classe:
            self.liste_comp.append([
                note['competence'], note['competence__famille'],
                note['competence__reference'], note['competence__nom'], "",
                "danger"
            ])
            self.liste_label.append(note['competence__reference'])
            self.notes_classe.append(note['moyenne'])

        index = 0

        for note in notes:
            while note['competence'] != self.liste_comp[index][0]:
                self.liste_comp[index][4] = 0
                self.notes_eleve.append(0)
                index += 1
            if note['moyenne'] != None:
                if float(note['moyenne']) > 3.5:
                    self.liste_comp[index][5] = "success"
                elif float(note['moyenne']) > 1.5:
                    self.liste_comp[index][5] = "warning"
                self.notes_eleve.append(note['moyenne'])
                self.liste_comp[index][4] = note['moyenne']
            else:
                self.notes_eleve.append(0)
            index += 1