From 84b25710bb2cb28348166e01172b8ccb0ff16edc Mon Sep 17 00:00:00 2001 From: Adil Mohak Date: Sun, 6 Oct 2024 11:29:22 +0300 Subject: [PATCH] Fix: student result form --- result/models.py | 10 +++++----- result/views.py | 17 +++++------------ 2 files changed, 10 insertions(+), 17 deletions(-) diff --git a/result/models.py b/result/models.py index a24dfc0..ba03619 100644 --- a/result/models.py +++ b/result/models.py @@ -114,11 +114,11 @@ class TakenCourse(models.Model): def get_total(self): return sum( [ - self.assignment, - self.mid_exam, - self.quiz, - self.attendance, - self.final_exam, + Decimal(self.assignment), + Decimal(self.mid_exam), + Decimal(self.quiz), + Decimal(self.attendance), + Decimal(self.final_exam), ] ) diff --git a/result/views.py b/result/views.py index cf59b75..ef2cad9 100644 --- a/result/views.py +++ b/result/views.py @@ -149,25 +149,18 @@ def add_score_for(request, id): obj.attendance = attendance # set current student attendance score obj.final_exam = final_exam # set current student final_exam score - obj.total = obj.get_total( - assignment=assignment, - mid_exam=mid_exam, - quiz=quiz, - attendance=attendance, - final_exam=final_exam, - ) - obj.grade = obj.get_grade(total=obj.total) + obj.total = obj.get_total() + obj.grade = obj.get_grade() # obj.total = obj.get_total(assignment, mid_exam, quiz, attendance, final_exam) # obj.grade = obj.get_grade(assignment, mid_exam, quiz, attendance, final_exam) - obj.point = obj.get_point(grade=obj.grade) - - obj.comment = obj.get_comment(grade=obj.grade) + obj.point = obj.get_point() + obj.comment = obj.get_comment() # obj.carry_over(obj.grade) # obj.is_repeating() obj.save() - gpa = obj.calculate_gpa(total_credit_in_semester) + gpa = obj.calculate_gpa() cgpa = obj.calculate_cgpa() try: