Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ public enum DisplayFormat {RADIO, CHECKBOX, DROPDOWN}
/**
* Filter applied to dynamic response options (VTL expression).
*/
@Pogues("getOptionFilter()")
@Pogues("getResponse().getFirst().getChoiceType() == T(fr.insee.pogues.model.ChoiceTypeEnum).VARIABLE ? " +
"getResponse().getFirst().getOptionFilter() : null")
@Lunatic("setOptionFilter(#param)")
CalculatedExpression optionFilter;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import fr.insee.eno.core.annotations.Lunatic;
import fr.insee.eno.core.annotations.Pogues;
import fr.insee.eno.core.exceptions.technical.MappingException;
import fr.insee.eno.core.model.calculated.CalculatedExpression;
import fr.insee.eno.core.model.code.CodeItem;
import fr.insee.eno.core.model.question.UniqueChoiceQuestion;
import fr.insee.eno.core.parameter.Format;
Expand Down Expand Up @@ -56,6 +57,14 @@ public class UniqueChoiceCell extends ResponseCell {
@Lunatic("setOptionSource(#param)")
String optionSource;

/**
* Filter applied to dynamic response options (VTL expression).
*/
@Pogues("getChoiceType() == T(fr.insee.pogues.model.ChoiceTypeEnum).VARIABLE ? " +
"#root.getOptionFilter() : null")
@Lunatic("setOptionFilter(#param)")
CalculatedExpression optionFilter;

@Lunatic("getOptions()")
List<CodeItem> codeItems = new ArrayList<>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ void variableOptionsCase() {
poguesUCQ.getResponse().getFirst().setChoiceType(ChoiceTypeEnum.VARIABLE);
poguesUCQ.getResponse().getFirst().setVariableReference("variable-id");

// option filter
poguesUCQ.getResponse().getFirst().setOptionFilter("my filter");

poguesSequence.getChild().add(poguesUCQ);
poguesQuestionnaire.getChild().add(poguesSequence);

Expand All @@ -103,6 +106,7 @@ void variableOptionsCase() {
// Then
enoUCQ = assertInstanceOf(UniqueChoiceQuestion.class, enoQuestionnaire.getSingleResponseQuestions().getFirst());
assertEquals("SOME_ITERATION_VARIABLE", enoUCQ.getOptionSource());
assertEquals("my filter", enoUCQ.getOptionFilter().getValue());
}

}
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<!-- Plugin versions -->
<jacoco.version>0.8.14</jacoco.version>
<!-- Model versions -->
<poguesModel.version>1.15.3</poguesModel.version>
<poguesModel.version>1.15.5</poguesModel.version>
<lunaticModel.version>5.15.0</lunaticModel.version>
</properties>

Expand Down
Loading