-
Notifications
You must be signed in to change notification settings - Fork 45
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
Bug: {mycoursescards[ categoryID(s)]} tag gets left behind #278
Comments
Hi @Thomas-Nichay , FilterCodes only processes valid tags. If a tag is not valid, as is the case with an invalid category ID, the tag is not interpreted so that you can see that it is not working. Best regards, Michael |
Thank you for explaining @michael-milette, In such cases, cases an empty return would be much more preferable. |
If you are trying to display courses in which the user may or may not have yet enrolled, you might want to consider using the {coursecards} tag instead. Sounds to me like this might better suit your needs. Best regards, Michael |
I was trying to keep the issue generic, in terms of use cases, but in my specific use case, I am attempting to beautify the category navigation, giving students an easier way to view courses they are enrolled in, while concealing those they have chosen not to enroll or have yet to enroll. The enrollment process is handled separately. The results are a navigation panel that works really well with the breadcrumb links in each course no matter the category they are in. The mycoursescards tag works great for this, besides the fact of the debug error message if it ends up not finding any courses enrolled. If the result is empty i am able to give an actual error message with some feedback "No enrolled courses in this category" but printing the full tag as it is, prevents this form being handled instantly with css. This is why i think this behavior as it is now is undesirable, filtercodes didn't hit anything invalid it just found an empty query result that is correct to be returned as empty. |
Prerequisites
What happened?
When {mycoursescards[ categoryID(s)]} is used with the optional categoryID parameter but the query finds no courses, the tag does not get replaced with an empty string, being shown in whatever content like it was not filtered.
What do you think should have happened?
I expected that if the query doesn't find any course to generate cards, to not show anything, not even the original tag.
Steps to reproduce
Screenshots
No response
Moodle version
Moodle 4.1.5 (Build: 20230814)
Installed Moodle UI Language packs.
If other language(s), please specify
No response
Workaround
No response
Additional information
i fixed it locally by adding
to the line 2932 of filter.php
moodle-filter_filtercodes/filter.php
Lines 2930 to 2932 in fff6aa5
System information
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: