-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix two scenarios where null values were causing errors #473
Conversation
This hasn't been tested (other than the automatic tests) |
I'm told that the quiz fix works, but the assignment grade does not and there's still a "assignfeedback_comments not found" error. I find this surprising given that it's inside a try-catch block. I'll need to take another look. |
@ryansmith94 @davidpesce Please take a look at: https://github.com/xAPI-vle/moodle-logstore_xapi/blob/master/src/transformer/repos/MoodleRepository.php#L53 and moodle-logstore_xapi/src/transformer/events/mod_assign/assignment_graded.php Lines 34 to 37 in 8fa1eea
In the MoodleRespository, is there any reason we need to throw an exception, rather than returning false, if a record is not found? For graded assignments, I don't believe we have any possible way of knowing before making the DB request whether or not there will be a comment entry in the DB. |
Yeah we throw an error because it's a clearer error than a |
Returning false is somewhat equivalent to returning null... "the billion dollar mistake" |
Wrapping it in a try catch is what I tried but apparently the error is still getting through somehow. I need to make some time to replicate this on my own Moodle so I can test properly. Or better, perhaps I can set up a test case for this. |
Turns out that this was a namespace issue where the exception was being thrown as |
@ryansmith94 this is now ready for review |
Looks good to me @garemoko, think we should add some tests for this to avoid this becoming a problem again? |
@ryansmith94 tests added. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, tests look good thanks Andrew 👍
🎉 This PR is included in version 4.2.3 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Description
Related Issues
None
PR Type
Fix