InseeFr / Lunatic

Library of questionnaire components
https://inseefr.github.io/Lunatic/
MIT License
20 stars 22 forks source link

non paginated loop : controls are not displayed if loop dimension is "static" #1152

Open QRuhier opened 1 month ago

QRuhier commented 1 month ago

Describe the bug

When setting a non paginated loop with a fixed value of min/max number of iterations (even if it is defined by an external variable) , controls are not displayed.

There is no problem if the dimension is defined by a non static value (collected, calculated with real calculation...).

The problem is present, with and without Question component.

To Reproduce

Steps to reproduce the behavior:

working.json not_working.json

Expected behavior

Controls should be displayed in non paginated loop whatever how we define the number of iterations

Screenshots

Version where the bug appeared

Browser where the bug was tested

Additional context

Add any other context about the problem here.

QRuhier commented 1 month ago

@Grafikart First explanation :

Grafikart commented 1 month ago

@QRuhier Pas évident celui là. Je dirais que la bonne solution dans un cas de boucle fixe serait d'initialiser la variable avec la bonne taille

{
    "name": "PRENOMS",
    "values": {
        "EDITED": [],
        "FORCED": [],
        "INPUTTED": [],
        "PREVIOUS": [],
        "COLLECTED": [null, null, null]
    },
    "dimension": 1,
    "variableType": "COLLECTED",
    "iterationReference": "m0nk8xx7"
},