DB Execute Failed. ERROR: division by zero CONTEXT
Hello, I am running into a database execute error when trying to input final grades for one student. Other students are working fine. I am able to input grades with now issue. However, when trying to perform input final grades for any subject I receive the below error.
DB Execute Failed. ERROR: division by zero CONTEXT: SQL statement "UPDATE student_mp_stats SET cum_weighted_factor = sum_weighted_factors/gp_credits, cum_unweighted_factor = sum_unweighted_factors/gp_credits WHERE student_mp_stats.student_id = s_id and cast(student_mp_stats.marking_period_id as text) = mp_id" PL/pgSQL function calc_cum_gpa(character varying,integer) line 7 at SQL statement SQL statement "SELECT calc_cum_gpa(NEW.marking_period_id::varchar, NEW.student_id::int)" PL/pgSQL function t_update_mp_stats() line 17 at PERFORM Failure Notice
INSERT INTO STUDENT_REPORT_CARD_GRADES (ID,SYEAR,SCHOOL_ID,STUDENT_ID, COURSE_PERIOD_ID,MARKING_PERIOD_ID,REPORT_CARD_GRADE_ID,GRADE_PERCENT,COMMENT, GRADE_LETTER,WEIGHTED_GP,UNWEIGHTED_GP,GP_SCALE,COURSE_TITLE,CREDIT_ATTEMPTED, CREDIT_EARNED,CLASS_RANK,CREDIT_HOURS) VALUES(nextval('student_report_card_grades_id_seq'),'2020','1','118304','21','13','3','92.8',NULL,'A-','3.75',NULL,'4.000','Monarch: Science 300','0.00000000000000000000','0.00000000000000000000','Y',180.00)
RosarioSIS: 7.7 PHP: 7.3 PostgreSQL: 12 Server: Centos 7.9 Browser: Firefox (latest update)
Thank you for your help and attention.
Mario