I have the following code, I get persons from sqlalchemy query and Flask, I want to print the shift only when is different, but the condition is always false. I don't know what happen:
{% set actual_shift = 0 %}
{% for person in persons %}
{% if actual_shift == person.shift|safe %}
<p></p>
{% else %}
{% set actual_shift = person.shift |safe %}
{% set actual_shift = actual_shift |int %}
<p>{{ actual_shift }}</p>
{% endif %}
<label class="form-check-label" for="{{ person.username }}"><input type="checkbox" value="{{person.person_id}}" class="form-check-input" id="{{ person.username }}" name="persons" checked>{{person.fname}} {{person.lname}}</label>
{% endfor %}