Skip to content
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

Resolve PHP errors #58

Merged
merged 3 commits into from
Apr 26, 2024
Merged

Conversation

marxjohnson
Copy link
Contributor

No description provided.

When highestgrade is fetched from the database, it is returned as a
string containing a float value. There is an `if
($record->highestgrade)` check before using this to calculate a grade
percentage, to avoid dividing by highestgrade if it is falsy (e.g "0").
However, if it is zero, the returned string is "0.00000", which is
truthy.

Casting the string to a float ensures the check performs as intended.
Lots of "Error writing to database" exceptions are being reported in the
shutdown function that writes event logs on this page. It's not clear
why, but it's possible that its because the event are being triggered
right at the end of the script, after the page output has been
completed.

Since the logs are buffered and written during the shutdown, there
should be no performance issue triggerring the events earlier, so
hopefully this is also prevent the database errors.
@aspark21 aspark21 merged commit e7cc04f into uclmoodle:main Apr 26, 2024
0 of 7 checks passed
@aspark21
Copy link
Collaborator

Reviewed GHA failures, these are due to changes to moodle-cs and pre-existing behat failures in php8.2 - not related to this change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants