Additional Custom Templates in Reports not working in V21.0.01

I just amazed by the behavior of reports module in Gibbon as in Template Builder Reports-Courses just working fine but when I Include the same by changing name it does not work . Can you please look into it respected @ross and @rossdotparker

When I change/edit working templates they become unstable and does not work

Hi Ghulam, the templates use a YML syntax for the front-matter, which is the part between the {# and #}, and Twig templating syntax for the rest of the template. If any of the changes you make introduce a syntax error, then this could cause the template to not work as expected. I suspect it would depend on the type of change you’ve made, so you may need to share more information about the templates you’re editing.

Thanks @ross fro guidance . I am sharing templates

#1 Reports-Course

{##}
{{- stylesheet ? include(stylesheet) -}}
{% for course in courseCriteria %}
{% if not loop.first %}

 
{% endif %}
{{- course.courseName }} {% for teacher in course.teachers %} {{- teacher.fullName -}} {{ not loop.last ? ',' }} {% endfor %}
{%- for criteria in []|merge(course.perGroup|default([]))|merge(course.perStudent|default([])) -%} {% if criteria.valueType == 'Comment' %} {% else %} {% endif %}
{{- criteria.criteriaName -}}
{{- criteria.comment -}}
{{- criteria.criteriaName }}: {{ criteria.descriptor ? criteria.descriptor : criteria.value -}}
{% if not loop.last %}
 
{% endif %} {%- endfor -%}
{% endfor %}

#2

{##}
{{- stylesheet ? include(stylesheet) -}}

Subject Teacher's Name Total Marks Marks Obtained
{% for course in courseCriteria %} {%- for criteria in []|merge(course.perGroup|default([]))|merge(course.perStudent|default([])) -%} {% if criteria.valueType == 'Comment' %} {% else %} {% endif %} {%- endfor -%}
{{- course.courseName }} {% for teacher in course.teachers %} {{- teacher.fullName -}} {{ not loop.last ? ',' }} {% endfor %} {{- criteria.comment -}} {{- Criteria.name }} {{ criteria.value -}}
{% endfor %}

When I just copy and make some editing even a single letter change it does not work

We are now at the end of academic session and needs to generate Reports through reports module but following potential error is encountering

Home > Reports > Template Builder > Manage Asset
Report - Courses …Duplicate Duplicate
Rename it to courseCriteriaA21.twig.html
Change its name to name: Report - CoursesA21
Then Click Preview Preview
and preview generates nothing as in screen shot
image.png
And this also does not generate results in Generate Reports.

Can you please suggest a way out as we need to solve this urgently.
I can provide you with login credentials of our Gibbon website if you need.

Preview of asset

Hi Ghulam, I wonder if this is a file permission error, in that the file is perhaps being created but isn’t then readable? A couple things to check would be the Custom Asset Path in Reports > Reports Settings, then go to that location in your server and check the file permissions of the templates.

It looks like sharing the templates via copy-pasting wont work on the forums, because the HTML is stripped out. You’re welcome to zip them and upload as attachments, or email them to support@gibbonedu.org

Custom Asset path is /uploads/reports

Permissions

One thing I noted is that when I edit and save the asset , It removes all the blank lines and indentations itself

Oh, the indentations are very important for the yml syntax, that would certainly cause the errors you’re seeing. What text editor are you using to edit these files? It sounds like it may be stripping out some very necessary whitespace.

I am not using any editor but I edit in build in editor in assets using edit or pencil icon

Hmm, I’m not seeing the same behaviour, I’ve just tested editing an asset and it’s working well. What browser are you using? Otherwise, I wonder if you did use a basic text editor and duplicate the template inside the folder and then edit it, if that would work.

I am using Google Chrome for Linux Mint. May I sent you login credentials to check inside our Gibbon to see what is the issue here

Hi Ghulam,

Sure, if you send the credentials to support@gibbonedu.org I can take a quick peek to see if I can spot the issue.

Hi Respected @ross ,
I have emailed the login credentials at support@gibbonedu.org

Hi Ghulam,

I took a quick look at your system and it does appear there is something odd with the indentation being removed from template files. YML syntax requires specific indentation, so this is certainly the cause of the errors. However, it seems to be file permission related or something similar, as when I try to save a duplicated template (headers/logoRightTest.twig.html, which I used as a test) in this case, I get an error message which for this script is likely caused by the inability for the templates_assets_components_editProcess.php script to write the updated file to the server.

This does seem to be server related rather than code related, can you check that not only the files are accessible by the web server, but the folder as well.

Folder permission is 755 and files 644. Is that OK or I need to change that