05/26 Fix form labels aren't displayed

This commit is contained in:
2026-05-26 14:10:13 -04:00
parent d658eb030d
commit 650f291784
+11 -6
View File
@@ -544,16 +544,21 @@
{% endfor %} {% endfor %}
{# 1b: walk fields in order; accumulate label IDs. {# 1b: walk fields in order; accumulate label IDs.
When we hit a rated field (score>0), mark ALL accumulated label IDs as visible When we hit any answered field (rating > 0, pass_fail answered, text filled, etc.),
and clear the buffer. Never clear the buffer for non-rating fields — labels mark ALL accumulated label IDs as visible and clear the buffer. #}
can sit several rows above the ratings they introduce. #}
{% set lbuf = namespace(ids=[]) %} {% set lbuf = namespace(ids=[]) %}
{% for field in form_fields %} {% for field in form_fields %}
{% if field.type == 'label' %} {% if field.type == 'label' %}
{% set lbuf.ids = lbuf.ids + [field.id] %} {% set lbuf.ids = lbuf.ids + [field.id] %}
{% elif field.type == 'rating' %} {% elif field.type not in _skip_types %}
{% set score = form_data.get(field.id | string, '0') | int %} {% set fval = form_data.get(field.id | string, '') %}
{% if score > 0 %} {% set answered = namespace(v=false) %}
{% if field.type == 'rating' %}
{% if fval | int > 0 %}{% set answered.v = true %}{% endif %}
{% elif fval and fval != '' and fval != [] %}
{% set answered.v = true %}
{% endif %}
{% if answered.v %}
{% for lid in lbuf.ids %} {% for lid in lbuf.ids %}
{% if lid not in ns.visible_label_ids %} {% if lid not in ns.visible_label_ids %}
{% set ns.visible_label_ids = ns.visible_label_ids + [lid] %} {% set ns.visible_label_ids = ns.visible_label_ids + [lid] %}