InseeFr / Lunatic

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

Resizing: handle case when a variable resizes both iteration and pairwise variables #879

Closed nsenave closed 8 months ago

nsenave commented 8 months ago

Feature Description

Allow a single variable to resize both iteration variables (e.g. loop or roster for loop variables) and the pairwise variable.

Use Case

With a resizing entry that look like this ine the source json:

{
  "resizing": {
    "FIRST_NAME": {
      "size": "count(FIRST_NAME)",
      "variables": ["LOOP_VAR1", "LOOP_VAR2"],
      "sizeForLinksVariables": [
        "count(FIRST_NAME)",
        "count(FIRST_NAME)"
      ],
      "linksVariables": ["LINKS"]
    }
  }
}

loop variables "LOOP_VAR1", "LOOP_VAR2" and pairwise variable "LINKS" should be resizied.

Proposed Solution

A priori few changes in src/use-lunatic/commons/variables/behaviours/resizing-behaviour.ts (seen with @Grafikart )

Alternatives Considered

Additional Context

Currently if both cases are present in a single resizing entry, the pairwise resizing is done, other iteration variables are not resized. I think this might cause unexpected issues later on.

Priority

Attachments

Related Issues

Issue to be created in Eno to generate such an entry in the "resizing" if this case occurs.