Description / Beschreibung
issue was written with help of ChatGPT
The "View Answers" page does not display the titles of QuestionSets.
When a catalog has:
Section
└── Page
└── QuestionSet
├── Question
└── Question
the "View Answers" currently only renders:
Section
└── Page
├── Question
└── Question
The QuestionSets, or nested QuestionSets, are missing.
The current templates may explain the behavior:
https://github.com/rdmorganiser/rdmo/blob/main/rdmo/projects/templates/projects/project_answers_tree.html
It renders Section and Page titles and delegates each Page element to:
https://github.com/rdmorganiser/rdmo/blob/main/rdmo/projects/templates/projects/project_answers_element.html
For Questions, project_answers_element.html renders the question text and corresponding values. For QuestionSets, however, it only recursively renders the contained elements:
|
{# this is a questionset #} |
The available element.title is not rendered.
Regression
This also seems to be at least partly a regression.
The implementation associated with #318 / #320 previously rendered top-level QuestionSet titles in project_answers_tree.html:
#320
<h3>{{ questionset.title }}</h3>
Later, when the Page model was introduced in:
471c408
the tree changed approximately from:
{% for questionset in section.questionsets.all %}
<h3>{{ questionset.title }}</h3>
...
{% endfor %}
to:
{% for page in section.pages.all %}
<h3>{{ page.title }}</h3>
{% for element in page.elements %}
{% include 'projects/project_answers_element.html' %}
{% endfor %}
{% endfor %}
Since the recursive project_answers_element.html template does not render QuestionSet titles itself, the QuestionSet heading disappeared from "View Answers".
Nested QuestionSets appear to have had the same problem already when support for nested QuestionSets was introduced.
Expected behaviour / Erwartetes Verhalten
"View Answers" should preserve the structural hierarchy of the catalog and display QuestionSet titles before their contained questions/elements.
For example:
Section title
Page title
QuestionSet title
Question?
Answer
Question?
Answer
Another QuestionSet
Question?
Answer
Nested QuestionSets should also retain their titles, for example:
Page
└── QuestionSet A
└── QuestionSet B
└── Question
should not be flattened to:
The exact HTML heading levels or styling could follow the existing hierarchy. For example, Section and Page currently use h2 and h3; QuestionSets could use an appropriate lower-level heading or dedicated styling.
Empty QuestionSet titles should of course not result in empty headings.
QuestionSet titles should support Markdown consistently with the existing Section/Page titles.
Exports
The same hierarchy should also be retained in exports created from the "View Answers" page.
project_answers_export.html uses the same tree:
https://github.com/rdmorganiser/rdmo/blob/main/rdmo/projects/templates/projects/project_answers_export.html
{% include 'projects/project_answers_tree.html' %}
so fixing the recursive tree rendering should also make QuestionSet titles available in the corresponding answer exports.
Steps to reproduce / Schritte zum Reproduzieren
-
Create or use a Catalog containing:
- a Section and a Page
- a QuestionSet with a non-empty title,
- one or more Questions inside that QuestionSet.
-
Create a Project using the Catalog.
-
Answer the Questions.
-
Open View Answers.
-
See that the Section title, Page title, Questions and Answers are displayed, but the QuestionSet title is missing.
-
Optionally create a nested QuestionSet and observe that its title is missing as well.
-
Export the answers from this page and observe the same missing QuestionSet structure.
References / Verweise
Description / Beschreibung
The "View Answers" page does not display the titles of QuestionSets.
When a catalog has:
the "View Answers" currently only renders:
The QuestionSets, or nested QuestionSets, are missing.
The current templates may explain the behavior:
https://github.com/rdmorganiser/rdmo/blob/main/rdmo/projects/templates/projects/project_answers_tree.html
It renders Section and Page titles and delegates each Page element to:
https://github.com/rdmorganiser/rdmo/blob/main/rdmo/projects/templates/projects/project_answers_element.html
For Questions,
project_answers_element.htmlrenders the question text and corresponding values. For QuestionSets, however, it only recursively renders the contained elements:rdmo/rdmo/projects/templates/projects/project_answers_element.html
Line 46 in 9f48c2f
The available
element.titleis not rendered.Regression
This also seems to be at least partly a regression.
The implementation associated with #318 / #320 previously rendered top-level QuestionSet titles in
project_answers_tree.html:#320
Later, when the Page model was introduced in:
471c408
the tree changed approximately from:
to:
Since the recursive
project_answers_element.htmltemplate does not render QuestionSet titles itself, the QuestionSet heading disappeared from "View Answers".Nested QuestionSets appear to have had the same problem already when support for nested QuestionSets was introduced.
Expected behaviour / Erwartetes Verhalten
"View Answers" should preserve the structural hierarchy of the catalog and display QuestionSet titles before their contained questions/elements.
For example:
Nested QuestionSets should also retain their titles, for example:
should not be flattened to:
The exact HTML heading levels or styling could follow the existing hierarchy. For example, Section and Page currently use
h2andh3; QuestionSets could use an appropriate lower-level heading or dedicated styling.Empty QuestionSet titles should of course not result in empty headings.
QuestionSet titles should support Markdown consistently with the existing Section/Page titles.
Exports
The same hierarchy should also be retained in exports created from the "View Answers" page.
project_answers_export.htmluses the same tree:https://github.com/rdmorganiser/rdmo/blob/main/rdmo/projects/templates/projects/project_answers_export.html
so fixing the recursive tree rendering should also make QuestionSet titles available in the corresponding answer exports.
Steps to reproduce / Schritte zum Reproduzieren
Create or use a Catalog containing:
Create a Project using the Catalog.
Answer the Questions.
Open View Answers.
See that the Section title, Page title, Questions and Answers are displayed, but the QuestionSet title is missing.
Optionally create a nested QuestionSet and observe that its title is missing as well.
Export the answers from this page and observe the same missing QuestionSet structure.
References / Verweise
https://github.com/rdmorganiser/rdmo/blob/main/rdmo/projects/templates/projects/project_answers_tree.html
https://github.com/rdmorganiser/rdmo/blob/main/rdmo/projects/templates/projects/project_answers_element.html
https://github.com/rdmorganiser/rdmo/blob/main/rdmo/projects/assets/js/interview/components/main/questionset/QuestionSet.js
"View answers" does not show all answers #318
Fix project_answers_tree.html for sets #320
471c408