From 2579af9b8b397d24e66ee08365e345f81bfb00cf Mon Sep 17 00:00:00 2001 From: N3WT DE COMPET Date: Sat, 4 Apr 2026 10:49:35 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20coorection=20d=C3=A9marrage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Back-End/School/models.py | 22 +--------------------- Back-End/School/serializers.py | 5 ++--- Back-End/School/views.py | 5 ++--- Back-End/Subscriptions/models.py | 21 +++++++++++++++++++++ 4 files changed, 26 insertions(+), 27 deletions(-) diff --git a/Back-End/School/models.py b/Back-End/School/models.py index 44427ad..35db647 100644 --- a/Back-End/School/models.py +++ b/Back-End/School/models.py @@ -178,24 +178,4 @@ class Evaluation(models.Model): ordering = ['-date', '-created_at'] def __str__(self): - return f"{self.name} - {self.speciality.name} ({self.school_class.atmosphere_name})" - - -class StudentEvaluation(models.Model): - """ - Note d'un élève pour une évaluation. - """ - student = models.ForeignKey('Subscriptions.Student', on_delete=models.CASCADE, related_name='evaluation_scores') - evaluation = models.ForeignKey(Evaluation, on_delete=models.CASCADE, related_name='student_scores') - score = models.DecimalField(max_digits=5, decimal_places=2, null=True, blank=True) - comment = models.TextField(blank=True) - is_absent = models.BooleanField(default=False) - created_at = models.DateTimeField(auto_now_add=True) - updated_at = models.DateTimeField(auto_now=True) - - class Meta: - unique_together = ('student', 'evaluation') - - def __str__(self): - score_display = 'Absent' if self.is_absent else self.score - return f"{self.student} - {self.evaluation.name}: {score_display}" \ No newline at end of file + return f"{self.name} - {self.speciality.name} ({self.school_class.atmosphere_name})" \ No newline at end of file diff --git a/Back-End/School/serializers.py b/Back-End/School/serializers.py index b927297..a9a842c 100644 --- a/Back-End/School/serializers.py +++ b/Back-End/School/serializers.py @@ -11,11 +11,10 @@ from .models import ( PaymentMode, EstablishmentCompetency, Competency, - Evaluation, - StudentEvaluation + Evaluation ) from Auth.models import Profile, ProfileRole -from Subscriptions.models import Student +from Subscriptions.models import Student, StudentEvaluation from Establishment.models import Establishment from Auth.serializers import ProfileRoleSerializer from N3wtSchool import settings diff --git a/Back-End/School/views.py b/Back-End/School/views.py index d5843c0..8c41d99 100644 --- a/Back-End/School/views.py +++ b/Back-End/School/views.py @@ -17,8 +17,7 @@ from .models import ( PaymentMode, EstablishmentCompetency, Competency, - Evaluation, - StudentEvaluation + Evaluation ) from .serializers import ( TeacherSerializer, @@ -38,7 +37,7 @@ from Common.models import Domain, Category from N3wtSchool.bdd import delete_object, getAllObjects, getObject from django.db.models import Q from collections import defaultdict -from Subscriptions.models import Student, StudentCompetency +from Subscriptions.models import Student, StudentCompetency, StudentEvaluation from Subscriptions.util import getCurrentSchoolYear import logging from N3wtSchool.mailManager import sendRegisterForm, sendRegisterTeacher diff --git a/Back-End/Subscriptions/models.py b/Back-End/Subscriptions/models.py index a54767d..7c216ce 100644 --- a/Back-End/Subscriptions/models.py +++ b/Back-End/Subscriptions/models.py @@ -589,6 +589,27 @@ class StudentCompetency(models.Model): def __str__(self): return f"{self.student} - {self.establishment_competency} - Score: {self.score} - Period: {self.period}" + +class StudentEvaluation(models.Model): + """ + Note d'un élève pour une évaluation. + Déplacé depuis School pour éviter les dépendances circulaires. + """ + student = models.ForeignKey('Subscriptions.Student', on_delete=models.CASCADE, related_name='evaluation_scores') + evaluation = models.ForeignKey('School.Evaluation', on_delete=models.CASCADE, related_name='student_scores') + score = models.DecimalField(max_digits=5, decimal_places=2, null=True, blank=True) + comment = models.TextField(blank=True) + is_absent = models.BooleanField(default=False) + created_at = models.DateTimeField(auto_now_add=True) + updated_at = models.DateTimeField(auto_now=True) + + class Meta: + unique_together = ('student', 'evaluation') + + def __str__(self): + score_display = 'Absent' if self.is_absent else self.score + return f"{self.student} - {self.evaluation.name}: {score_display}" + ####### Parent files templates (par dossier d'inscription) ####### class RegistrationParentFileTemplate(models.Model): master = models.ForeignKey(RegistrationParentFileMaster, on_delete=models.CASCADE, related_name='parent_file_templates', blank=True)