Skip to content

Commit 8c9eb78

Browse files
Save null percent: N/A for all children Marking Periods case
1 parent fecb599 commit 8c9eb78

File tree

3 files changed

+28
-7
lines changed

3 files changed

+28
-7
lines changed

CHANGES.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ Changes in 12.3
2121
- Use DBInsert() & DBUpdate() functions, program wide
2222
- Fix potential SQL error SELECT DISTINCT, ORDER BY expressions must appear in select list in ReportCards.fnc.php
2323
- CSS use .legend-gray.size-1 for details label in StudentAssignments.fnc.php
24-
- Fix regression since 12.2.3 Save null percent: N/A final grade
24+
- Fix regression since 12.2.3 Save null percent: N/A final grade in FinalGrades.inc.php
25+
- Save null percent: N/A for all children Marking Periods case in FinalGrades.inc.php
2526

2627
Changes in 12.2.3
2728
-----------------

WHATS_NEW.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
New in 12.3
66
-----------
77

8+
Grades
9+
- Input Final Grades: "N/A" grade (empty GPA value & Breakoff) is now handled by the "Get Gradebook Grades" link
10+
811
Scheduling
912
- Courses: Multilingual course (and subject) title
1013

modules/Grades/includes/FinalGrades.inc.php

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,7 @@ function FinalGradesQtrOrProCalculate( $cp_id, $mp_id, $assignment_type_id = 0 )
345345
*
346346
* @since 11.8
347347
* @since 12.2.3 Fix SQL error when percent grade > 999.9
348+
* @since 12.3 Save null percent: N/A final grade
348349
*
349350
* @global $warning Warning: Add "Final Grading Percentages are not configured."
350351
*
@@ -429,7 +430,14 @@ function FinalGradesSemOrFYCalculate( $cp_id, $mp_id, $mode = 'continue' )
429430

430431
foreach ( (array) $percents_RET as $student_id => $percents )
431432
{
432-
$total = $total_percent = 0;
433+
$total_percent = 0;
434+
435+
/**
436+
* N/A for all children Marking Periods case
437+
*
438+
* @since 12.3 Save null percent: N/A final grade
439+
*/
440+
$total = null;
433441

434442
foreach ( (array) $percents as $percent )
435443
{
@@ -450,6 +458,12 @@ function FinalGradesSemOrFYCalculate( $cp_id, $mp_id, $mode = 'continue' )
450458
}
451459
}
452460

461+
if ( is_null( $percent['GRADE_PERCENT'] ) )
462+
{
463+
// N/A final grade
464+
continue;
465+
}
466+
453467
$total += $percent['GRADE_PERCENT'] *
454468
issetVal( $gradebook_config[$prefix . $percent['MARKING_PERIOD_ID']] );
455469

@@ -459,11 +473,14 @@ function FinalGradesSemOrFYCalculate( $cp_id, $mp_id, $mode = 'continue' )
459473
if ( $total_percent != 0 )
460474
{
461475
$total /= $total_percent;
476+
477+
$total /= 100;
462478
}
463479

464-
if ( $total > 999.9 )
480+
if ( $total > 9.999 )
465481
{
466-
$total = '999.9';
482+
// Fix SQL error when percent grade > 999.9
483+
$total = '9.999';
467484
}
468485
elseif ( $total < 0 )
469486
{
@@ -472,9 +489,9 @@ function FinalGradesSemOrFYCalculate( $cp_id, $mp_id, $mode = 'continue' )
472489

473490
$import_RET[$student_id] = [
474491
1 => [
475-
'REPORT_CARD_GRADE_ID' => _makeLetterGrade( $total / 100, $cp_id, 0, 'ID' ),
476-
'GRADE_LETTER' => _makeLetterGrade( $total / 100, $cp_id, 0, 'TITLE' ),
477-
'GRADE_PERCENT' => round( $total, 1 ),
492+
'REPORT_CARD_GRADE_ID' => _makeLetterGrade( $total, $cp_id, 0, 'ID' ),
493+
'GRADE_LETTER' => _makeLetterGrade( $total, $cp_id, 0, 'TITLE' ),
494+
'GRADE_PERCENT' => is_null( $total ) ? null : round( $total * 100, 1 ),
478495
],
479496
];
480497
}

0 commit comments

Comments
 (0)