0% found this document useful (0 votes)
15 views4 pages

Foc

mystery

Uploaded by

0hqalx01p
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views4 pages

Foc

mystery

Uploaded by

0hqalx01p
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

SQL Error: SQLSTATE[22012]: Division by zero: 7 ERROR: division by zero Query: WITH

grading_scale AS ( SELECT g.id AS report_card_grade_id, g.title, g.sort_order,


g.gpa_value, g.weighted_gpa_value, g.credits, COALESCE(g.default_breakoff, 0) AS
breakoff FROM report_card_grades g JOIN course_periods cp ON g.scale_id =
cp.grade_scale_id AND g.school_id = cp.school_id AND g.syear = cp.syear WHERE
cp.course_period_id = :course_period_id__1 ) SELECT
s.student_id,s.last_name,s.student_id AS _student_id,_712134.possible AS
possible_712134,_712134.letter AS letter_712134,_712134.percentage AS
percent_712134, CASE WHEN CEILING(_712134.points) = FLOOR(_712134.points) THEN
ROUND(_712134.points, 0) ELSE ROUND(_712134.points, 2) END AS
points_712134 ,_713482.possible AS possible_713482,_713482.letter AS
letter_713482,_713482.percentage AS percent_713482, CASE WHEN
CEILING(_713482.points) = FLOOR(_713482.points) THEN ROUND(_713482.points, 0) ELSE
ROUND(_713482.points, 2) END AS points_713482 ,_712918.possible AS
possible_712918,_712918.letter AS letter_712918,_712918.percentage AS
percent_712918, CASE WHEN CEILING(_712918.points) = FLOOR(_712918.points) THEN
ROUND(_712918.points, 0) ELSE ROUND(_712918.points, 2) END AS
points_712918 ,_713481.possible AS possible_713481,_713481.letter AS
letter_713481,_713481.percentage AS percent_713481, CASE WHEN
CEILING(_713481.points) = FLOOR(_713481.points) THEN ROUND(_713481.points, 0) ELSE
ROUND(_713481.points, 2) END AS points_713481 ,_713483.possible AS
possible_713483,_713483.letter AS letter_713483,_713483.percentage AS
percent_713483, CASE WHEN CEILING(_713483.points) = FLOOR(_713483.points) THEN
ROUND(_713483.points, 0) ELSE ROUND(_713483.points, 2) END AS points_713483 FROM
students s LEFT JOIN LATERAL ( SELECT tmp.*, COALESCE(tmp.letter_override,
letter.grade) AS letter FROM ( SELECT ROUND(SUM(ag.points_scored) * 100 , 0) / 100
AS points, SUM(ag.points_possible) AS possible, CASE WHEN SUM(ag.points_scored) IS
NOT NULL AND SUM(ag.points_possible) > 0 THEN
CONCAT( CAST( ROUND(SUM(ag.points_scored) / SUM(ag.points_possible) * 100 , 0) AS
VARCHAR(255) ),'%' ) END AS percentage, CASE WHEN SUM(ag.points_possible) < 1 THEN
'EC' WHEN SUM(ag.points_scored) IS NULL THEN 'NG' ELSE CAST(NULL AS VARCHAR(255))
END AS letter_override, ROUND(SUM(ag.points_scored) / SUM(ag.points_possible) * 100
, 0) AS letter_calc FROM gradebook_assignment_types t JOIN students st ON
st.student_id = s.student_id JOIN LATERAL ( SELECT g.student_id AS student_id,
a.points AS points_possible, g.points AS points_scored, gs.gpa_value AS
gpa_value_scored, CASE --Sort extra credit assignments as 100 percent WHEN a.points
< 1 THEN 100 ELSE g.points / a.points END AS percentage FROM gradebook_assignments
a JOIN gradebook_assignments_join_course_periods j ON j.assignment_id =
a.assignment_id AND j.course_period_id = :course_period_id__2 AND
j.marking_period_id
IN(:combined_marking_period_ids__7, :combined_marking_period_ids__8, :combined_mark
ing_period_ids__9, :combined_marking_period_ids__10, :combined_marking_period_ids__
11) JOIN gradebook_grades g ON g.assignment_id = j.assignment_id LEFT JOIN
grading_scale gs ON g.letter_grade = gs.title WHERE g.student_id = st.student_id
AND a.assignment_type_id = t.assignment_type_id AND --Exempt grades score -1 points
g.points != -1 AND --Completion assignments a.points IS NOT NULL AND --A blank, but
there's a comment or highlight g.points IS NOT NULL AND a.exclude_from_average =
'0' AND j.publish_date <= CURRENT_TIMESTAMP AND 1=1 AND
( j.assigned_to_all_students = '1' OR EXISTS( SELECT 1 FROM
gradebook_assignment_assigned_students aas WHERE aas.assignment_id =
j.assignment_id AND aas.student_id = g.student_id ) ) ORDER BY percentage ASC,
a.points DESC OFFSET 0 ROWS ) ag ON true WHERE t.assignment_type_id = '712134' )
tmp LEFT JOIN LATERAL ( SELECT gs.title AS grade FROM grading_scale gs WHERE
gs.breakoff <= tmp.letter_calc ORDER BY gs.breakoff DESC, gs.sort_order OFFSET 0
ROWS FETCH FIRST 1 ROWS ONLY ) letter ON true ) _712134 ON true LEFT JOIN LATERAL (
SELECT tmp.*, COALESCE(tmp.letter_override, letter.grade) AS letter FROM ( SELECT
ROUND(SUM(ag.points_scored) * 100 , 0) / 100 AS points, SUM(ag.points_possible) AS
possible, CASE WHEN SUM(ag.points_scored) IS NOT NULL AND SUM(ag.points_possible) >
0 THEN CONCAT( CAST( ROUND(SUM(ag.points_scored) / SUM(ag.points_possible) * 100 ,
0) AS VARCHAR(255) ),'%' ) END AS percentage, CASE WHEN SUM(ag.points_possible) < 1
THEN 'EC' WHEN SUM(ag.points_scored) IS NULL THEN 'NG' ELSE CAST(NULL AS
VARCHAR(255)) END AS letter_override, ROUND(SUM(ag.points_scored) /
SUM(ag.points_possible) * 100 , 0) AS letter_calc FROM gradebook_assignment_types t
JOIN students st ON st.student_id = s.student_id JOIN LATERAL ( SELECT g.student_id
AS student_id, a.points AS points_possible, g.points AS points_scored, gs.gpa_value
AS gpa_value_scored, CASE --Sort extra credit assignments as 100 percent WHEN
a.points < 1 THEN 100 ELSE g.points / a.points END AS percentage FROM
gradebook_assignments a JOIN gradebook_assignments_join_course_periods j ON
j.assignment_id = a.assignment_id AND j.course_period_id = :course_period_id__3 AND
j.marking_period_id
IN(:combined_marking_period_ids__12, :combined_marking_period_ids__13, :combined_ma
rking_period_ids__14, :combined_marking_period_ids__15, :combined_marking_period_id
s__16) JOIN gradebook_grades g ON g.assignment_id = j.assignment_id LEFT JOIN
grading_scale gs ON g.letter_grade = gs.title WHERE g.student_id = st.student_id
AND a.assignment_type_id = t.assignment_type_id AND --Exempt grades score -1 points
g.points != -1 AND --Completion assignments a.points IS NOT NULL AND --A blank, but
there's a comment or highlight g.points IS NOT NULL AND a.exclude_from_average =
'0' AND j.publish_date <= CURRENT_TIMESTAMP AND 1=1 AND
( j.assigned_to_all_students = '1' OR EXISTS( SELECT 1 FROM
gradebook_assignment_assigned_students aas WHERE aas.assignment_id =
j.assignment_id AND aas.student_id = g.student_id ) ) ORDER BY percentage ASC,
a.points DESC OFFSET 0 ROWS ) ag ON true WHERE t.assignment_type_id = '713482' )
tmp LEFT JOIN LATERAL ( SELECT gs.title AS grade FROM grading_scale gs WHERE
gs.breakoff <= tmp.letter_calc ORDER BY gs.breakoff DESC, gs.sort_order OFFSET 0
ROWS FETCH FIRST 1 ROWS ONLY ) letter ON true ) _713482 ON true LEFT JOIN LATERAL (
SELECT tmp.*, COALESCE(tmp.letter_override, letter.grade) AS letter FROM ( SELECT
ROUND(SUM(ag.points_scored) * 100 , 0) / 100 AS points, SUM(ag.points_possible) AS
possible, CASE WHEN SUM(ag.points_scored) IS NOT NULL AND SUM(ag.points_possible) >
0 THEN CONCAT( CAST( ROUND(SUM(ag.points_scored) / SUM(ag.points_possible) * 100 ,
0) AS VARCHAR(255) ),'%' ) END AS percentage, CASE WHEN SUM(ag.points_possible) < 1
THEN 'EC' WHEN SUM(ag.points_scored) IS NULL THEN 'NG' ELSE CAST(NULL AS
VARCHAR(255)) END AS letter_override, ROUND(SUM(ag.points_scored) /
SUM(ag.points_possible) * 100 , 0) AS letter_calc FROM gradebook_assignment_types t
JOIN students st ON st.student_id = s.student_id JOIN LATERAL ( SELECT g.student_id
AS student_id, a.points AS points_possible, g.points AS points_scored, gs.gpa_value
AS gpa_value_scored, CASE --Sort extra credit assignments as 100 percent WHEN
a.points < 1 THEN 100 ELSE g.points / a.points END AS percentage FROM
gradebook_assignments a JOIN gradebook_assignments_join_course_periods j ON
j.assignment_id = a.assignment_id AND j.course_period_id = :course_period_id__4 AND
j.marking_period_id
IN(:combined_marking_period_ids__17, :combined_marking_period_ids__18, :combined_ma
rking_period_ids__19, :combined_marking_period_ids__20, :combined_marking_period_id
s__21) JOIN gradebook_grades g ON g.assignment_id = j.assignment_id LEFT JOIN
grading_scale gs ON g.letter_grade = gs.title WHERE g.student_id = st.student_id
AND a.assignment_type_id = t.assignment_type_id AND --Exempt grades score -1 points
g.points != -1 AND --Completion assignments a.points IS NOT NULL AND --A blank, but
there's a comment or highlight g.points IS NOT NULL AND a.exclude_from_average =
'0' AND j.publish_date <= CURRENT_TIMESTAMP AND 1=1 AND
( j.assigned_to_all_students = '1' OR EXISTS( SELECT 1 FROM
gradebook_assignment_assigned_students aas WHERE aas.assignment_id =
j.assignment_id AND aas.student_id = g.student_id ) ) ORDER BY percentage ASC,
a.points DESC OFFSET 0 ROWS ) ag ON true WHERE t.assignment_type_id = '712918' )
tmp LEFT JOIN LATERAL ( SELECT gs.title AS grade FROM grading_scale gs WHERE
gs.breakoff <= tmp.letter_calc ORDER BY gs.breakoff DESC, gs.sort_order OFFSET 0
ROWS FETCH FIRST 1 ROWS ONLY ) letter ON true ) _712918 ON true LEFT JOIN LATERAL (
SELECT tmp.*, COALESCE(tmp.letter_override, letter.grade) AS letter FROM ( SELECT
ROUND(SUM(ag.points_scored) * 100 , 0) / 100 AS points, SUM(ag.points_possible) AS
possible, CASE WHEN SUM(ag.points_scored) IS NOT NULL AND SUM(ag.points_possible) >
0 THEN CONCAT( CAST( ROUND(SUM(ag.points_scored) / SUM(ag.points_possible) * 100 ,
0) AS VARCHAR(255) ),'%' ) END AS percentage, CASE WHEN SUM(ag.points_possible) < 1
THEN 'EC' WHEN SUM(ag.points_scored) IS NULL THEN 'NG' ELSE CAST(NULL AS
VARCHAR(255)) END AS letter_override, ROUND(SUM(ag.points_scored) /
SUM(ag.points_possible) * 100 , 0) AS letter_calc FROM gradebook_assignment_types t
JOIN students st ON st.student_id = s.student_id JOIN LATERAL ( SELECT g.student_id
AS student_id, a.points AS points_possible, g.points AS points_scored, gs.gpa_value
AS gpa_value_scored, CASE --Sort extra credit assignments as 100 percent WHEN
a.points < 1 THEN 100 ELSE g.points / a.points END AS percentage FROM
gradebook_assignments a JOIN gradebook_assignments_join_course_periods j ON
j.assignment_id = a.assignment_id AND j.course_period_id = :course_period_id__5 AND
j.marking_period_id
IN(:combined_marking_period_ids__22, :combined_marking_period_ids__23, :combined_ma
rking_period_ids__24, :combined_marking_period_ids__25,
:combined_marking_period_ids__26) JOIN gradebook_grades g ON g.assignment_id =
j.assignment_id LEFT JOIN grading_scale gs ON g.letter_grade = gs.title WHERE
g.student_id = st.student_id AND a.assignment_type_id = t.assignment_type_id AND --
Exempt grades score -1 points g.points != -1 AND --Completion assignments a.points
IS NOT NULL AND --A blank, but there's a comment or highlight g.points IS NOT NULL
AND a.exclude_from_average = '0' AND j.publish_date <= CURRENT_TIMESTAMP AND 1=1
AND ( j.assigned_to_all_students = '1' OR EXISTS( SELECT 1 FROM
gradebook_assignment_assigned_students aas WHERE aas.assignment_id =
j.assignment_id AND aas.student_id = g.student_id ) ) ORDER BY percentage ASC,
a.points DESC OFFSET 0 ROWS ) ag ON true WHERE t.assignment_type_id = '713481' )
tmp LEFT JOIN LATERAL ( SELECT gs.title AS grade FROM grading_scale gs WHERE
gs.breakoff <= tmp.letter_calc ORDER BY gs.breakoff DESC, gs.sort_order OFFSET 0
ROWS FETCH FIRST 1 ROWS ONLY ) letter ON true ) _713481 ON true LEFT JOIN LATERAL (
SELECT tmp.*, COALESCE(tmp.letter_override, letter.grade) AS letter FROM ( SELECT
ROUND(SUM(ag.points_scored) * 100 , 0) / 100 AS points, SUM(ag.points_possible) AS
possible, CASE WHEN SUM(ag.points_scored) IS NOT NULL AND SUM(ag.points_possible) >
0 THEN CONCAT( CAST( ROUND(SUM(ag.points_scored) / SUM(ag.points_possible) * 100 ,
0) AS VARCHAR(255) ),'%' ) END AS percentage, CASE WHEN SUM(ag.points_possible) < 1
THEN 'EC' WHEN SUM(ag.points_scored) IS NULL THEN 'NG' ELSE CAST(NULL AS
VARCHAR(255)) END AS letter_override, ROUND(SUM(ag.points_scored) /
SUM(ag.points_possible) * 100 , 0) AS letter_calc FROM gradebook_assignment_types t
JOIN students st ON st.student_id = s.student_id JOIN LATERAL ( SELECT g.student_id
AS student_id, a.points AS points_possible, g.points AS points_scored, gs.gpa_value
AS gpa_value_scored, CASE --Sort extra credit assignments as 100 percent WHEN
a.points < 1 THEN 100 ELSE g.points / a.points END AS percentage FROM
gradebook_assignments a JOIN gradebook_assignments_join_course_periods j ON
j.assignment_id = a.assignment_id AND j.course_period_id = :course_period_id__6 AND
j.marking_period_id
IN(:combined_marking_period_ids__27, :combined_marking_period_ids__28, :combined_ma
rking_period_ids__29, :combined_marking_period_ids__30, :combined_marking_period_id
s__31) JOIN gradebook_grades g ON g.assignment_id = j.assignment_id LEFT JOIN
grading_scale gs ON g.letter_grade = gs.title WHERE g.student_id = st.student_id
AND a.assignment_type_id = t.assignment_type_id AND --Exempt grades score -1 points
g.points != -1 AND --Completion assignments a.points IS NOT NULL AND --A blank, but
there's a comment or highlight g.points IS NOT NULL AND a.exclude_from_average =
'0' AND j.publish_date <= CURRENT_TIMESTAMP AND 1=1 AND
( j.assigned_to_all_students = '1' OR EXISTS( SELECT 1 FROM
gradebook_assignment_assigned_students aas WHERE aas.assignment_id =
j.assignment_id AND aas.student_id = g.student_id ) ) ORDER BY percentage ASC,
a.points DESC OFFSET 0 ROWS ) ag ON true WHERE t.assignment_type_id = '713483' )
tmp LEFT JOIN LATERAL ( SELECT gs.title AS grade FROM grading_scale gs WHERE
gs.breakoff <= tmp.letter_calc ORDER BY gs.breakoff DESC, gs.sort_order OFFSET 0
ROWS FETCH FIRST 1 ROWS ONLY ) letter ON true ) _713483 ON true WHERE s.student_id
IN(:student_ids__0) ORDER BY s.last_name, s.first_name Parameters: Array
( [student_ids__0] => 2107946 [course_period_id__1] => 566250 [course_period_id__2]
=> 566250 [course_period_id__3] => 566250 [course_period_id__4] => 566250
[course_period_id__5] => 566250 [course_period_id__6] => 566250
[combined_marking_period_ids__7] => 67355 [combined_marking_period_ids__8] => 67361
[combined_marking_period_ids__9] => 67352 [combined_marking_period_ids__10] =>
67351 [combined_marking_period_ids__11] => 0 [combined_marking_period_ids__12] =>
67355 [combined_marking_period_ids__13] => 67361 [combined_marking_period_ids__14]
=> 67352 [combined_marking_period_ids__15] => 67351
[combined_marking_period_ids__16] => 0 [combined_marking_period_ids__17] => 67355
[combined_marking_period_ids__18] => 67361 [combined_marking_period_ids__19] =>
67352 [combined_marking_period_ids__20] => 67351 [combined_marking_period_ids__21]
=> 0 [combined_marking_period_ids__22] => 67355 [combined_marking_period_ids__23]
=> 67361 [combined_marking_period_ids__24] => 67352
[combined_marking_period_ids__25] => 67351 [combined_marking_period_ids__26] => 0
[combined_marking_period_ids__27] => 67355 [combined_marking_period_ids__28] =>
67361 [combined_marking_period_ids__29] => 67352 [combined_marking_period_ids__30]
=> 67351 [combined_marking_period_ids__31] => 0 ) Error Info: Array ( [0] => 00000
[1] => [2] => )

You might also like