InseeFr / Lunatic

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

Sum of Tab - init to 0 but null with no value after init #1159

Open JulienCarmona opened 15 hours ago

JulienCarmona commented 15 hours ago

Describe the bug

Quand on fait la somme d'une colonne TAB_COL d'un tableau TAB en VTL dans un var claculée SUM_TAB = sum($TAB_COL$),

  1. Quand SUM_TAB est init, elle vaut 0.
  2. Mais si on ajoute des valeurs et qu'ensuite on es supprime (case vide), alors on a null

To Reproduce

  1. With the survey m2iwuqca on Pogues PROD
  2. Go to visu DSFR
  3. Go to recap, and see sum = 0
  4. Go back to TAB, enter 25 and 10
  5. Go to recap and see sum = 35
  6. Go back to TAB
  7. Erase values
  8. Go to Recap
  9. See error : sum = null

Expected behavior

On voudrait que la somme soit 0 aussi

Screenshots

  1. image
  2. Image
  3. image

Version where the bug appeared

Lunatic : 3.4.4

Browser where the bug was tested

JulienCarmona commented 10 hours ago

Pas sûr de vouloir gérer ce cas, car on peut avec une variable intermédiaire calculée, gérer le null-check. Ex avec le questionnaire m2iwuqca

  1. creer NULL_CHECK_TAB_COL = nvl($TAB_COL$,0) avec une portée TAB
  2. SUM_TAB = sum($NULL_CHECK_TAB_COL$)