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

Acronyms with special characters cause error when using Attendance as datasource in Report Builder #752

Closed
Limekiller opened this issue Apr 29, 2024 · 1 comment
Labels

Comments

@Limekiller
Copy link
Contributor

Hi Dan,

We ran into an issue where--when using Attendance as a data source in the report builder--if there exists a mod_attendance instance that has a status set that contains an acronym with a special character, this will cause a fatal error in the report builder. The error occurs because the Attendance plugin creates a column for every unique acronym in the system, using the acronym itself as part of the column name, but Report Builder requires that column names be alphanumeric; indeed, Moodle throws an error that says as much (I can't remember the exact error text at the moment).

This should be reproducible by creating a new Attendance module, going to the Status Set page, and adding a new row with an acronym like "A+". Then, go to the report builder and create a new report using Attendance as the datasource. You should encounter a fatal error that prevents the page from loading.

The issue can be fixed by either requiring that acronyms be alphanumeric, or by changing the code that generates the column names from the acronyms in the system to escape special characters. If you let me know which of these approaches you'd rather take, I can probably create a pull request. Let me know if you need any more information.

@danmarsden
Copy link
Owner

I think it makes sense to escape the chars in the report builder source itself rather than forcing acronyms to use a certain format - there are some other feature requests like #645 and #671 that might increase the complexity of the acronym field in future too.

thanks!

@danmarsden danmarsden added the bug label Apr 30, 2024
Limekiller added a commit to Limekiller/moodle-mod_attendance that referenced this issue May 13, 2024
This small change encodes the acronym field names in Base64 (stripping trailing equals) to fix danmarsden#752. This keeps unique acronym names unique while removing special characters.
Limekiller added a commit to Limekiller/moodle-mod_attendance that referenced this issue May 13, 2024
This small change encodes the acronym field names in base64 (removing trailing equals) to fix danmarsden#752, where acronyms with special characters cause an issue because reportbuilder requires that filters and columns be alphanumeric. This keeps acronym names unique while removing special characters.
danmarsden pushed a commit that referenced this issue May 17, 2024
This small change encodes the acronym field names in base64 (removing trailing equals) to fix #752, where acronyms with special characters cause an issue because reportbuilder requires that filters and columns be alphanumeric. This keeps acronym names unique while removing special characters.
danmarsden pushed a commit that referenced this issue May 17, 2024
This small change encodes the acronym field names in base64 (removing trailing equals) to fix #752, where acronyms with special characters cause an issue because reportbuilder requires that filters and columns be alphanumeric. This keeps acronym names unique while removing special characters.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants