05/26 Fix form labels aren't displayed
This commit is contained in:
@@ -544,16 +544,21 @@
|
||||
{% endfor %}
|
||||
|
||||
{# 1b: walk fields in order; accumulate label IDs.
|
||||
When we hit a rated field (score>0), mark ALL accumulated label IDs as visible
|
||||
and clear the buffer. Never clear the buffer for non-rating fields — labels
|
||||
can sit several rows above the ratings they introduce. #}
|
||||
When we hit any answered field (rating > 0, pass_fail answered, text filled, etc.),
|
||||
mark ALL accumulated label IDs as visible and clear the buffer. #}
|
||||
{% set lbuf = namespace(ids=[]) %}
|
||||
{% for field in form_fields %}
|
||||
{% if field.type == 'label' %}
|
||||
{% set lbuf.ids = lbuf.ids + [field.id] %}
|
||||
{% elif field.type == 'rating' %}
|
||||
{% set score = form_data.get(field.id | string, '0') | int %}
|
||||
{% if score > 0 %}
|
||||
{% elif field.type not in _skip_types %}
|
||||
{% set fval = form_data.get(field.id | string, '') %}
|
||||
{% 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 %}
|
||||
{% if lid not in ns.visible_label_ids %}
|
||||
{% set ns.visible_label_ids = ns.visible_label_ids + [lid] %}
|
||||
|
||||
Reference in New Issue
Block a user