[Bugfix:InstructorUI] Fix Gradeable JSON Boolean Fields#12160
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #12160 +/- ##
=========================================
Coverage 21.73% 21.73%
Complexity 9598 9598
=========================================
Files 268 268
Lines 36006 36006
Branches 475 475
=========================================
Hits 7827 7827
Misses 27708 27708
Partials 471 471
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
Rkoester47
left a comment
There was a problem hiding this comment.
I followed the steps outlined in the PR to reproduce the issue on main. As expected, all three sections of the rubric were highlighted purple for TA grading even though I had only set the first one to "True".
After repeating steps on this branch, the issue appears to be resolved. I uploaded another copy of the Bulk Exam JSON file, and now only the first section was purple as intended. Based on the description of the issue and expected outcome of this PR, the changes made seemed to have resolved the issue.
| $this->setText($details['text']); | ||
| $this->setPeerComponent($details['peer_component'] ?? false); | ||
| $this->setText(Utils::getBooleanValue($details['text'])); | ||
| $this->setPeerComponent(Utils::getBooleanValue($details['peer_component'] ?? false)); |
There was a problem hiding this comment.
I believe that you don't need the ?? false part now, as the getBooleanValue handles null values and returns false for them.
There was a problem hiding this comment.
Good catch -- will update.


Why is this Change Important & Necessary?
Fixes #12151.
As described in the issue, uploading a Gradeable JSON currently results in peer grading being enabled regardless of the assignment of the
peer_componentproperty. This bug is caused by the Gradeable construction logic not interpretting certain values in the JSON as boolean, which results in a string being parsed instead. This has now been fixed via invocation of theUtils::getBooleanValuemethod.What steps should a reviewer take to reproduce or test the bug or new feature?
Download the Gradeable JSON of Bulk Upload Scanned Exam in the Sample course. Edit the JSON so that the
idfield is different (i.e. add_1to the existingid) and ensure that for one of the rubric sections,peer_componentis set totrueand that for another it is set tofalse. Create a new Gradeable in the Sample course by uploading this JSON. Note how both of the rubric sections are highlighted purple (indicating peer grading).Checkout this branch, repeat the same steps, and note how the peer grading sections are assigned properly.