Skip to content

Commit

Permalink
chore: merge commit for release 3.29.1
Browse files Browse the repository at this point in the history
Release 3.29.1
  • Loading branch information
nsenave authored Dec 6, 2024
2 parents 72c1603 + 1dce9fe commit 5ba4300
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 22 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ java {

allprojects {
group = "fr.insee.eno"
version = "3.29.0-hotfix.2"
version = "3.29.1"
}

subprojects {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package fr.insee.eno.core.model.question;

import fr.insee.ddi.lifecycle33.datacollection.GridDimensionType;
import fr.insee.ddi.lifecycle33.datacollection.QuestionGridType;
import fr.insee.ddi.lifecycle33.reusable.CommandCodeType;
import fr.insee.ddi.lifecycle33.reusable.CommandType;
Expand Down Expand Up @@ -92,22 +93,20 @@ public class DynamicTableQuestion extends MultipleResponseQuestion implements En
List<CellLabel> cellLabels = new ArrayList<>();

public static CommandType mapDDISizeExpression(QuestionGridType ddiDynamicTableQuestion) {
checkRank1Dimension(ddiDynamicTableQuestion);
CommandCodeType conditionForContinuation = ddiDynamicTableQuestion.getGridDimensionArray(0).getRoster()
.getConditionForContinuation();
GridDimensionType rank1Dimension = checkRank1Dimension(ddiDynamicTableQuestion);
CommandCodeType conditionForContinuation = rank1Dimension.getRoster().getConditionForContinuation();
if (conditionForContinuation == null)
return null;
return conditionForContinuation.getCommandArray(0);
}

private static void checkRank1Dimension(QuestionGridType ddiDynamicTableQuestion) {
boolean hasRank1Dimension = ddiDynamicTableQuestion.getGridDimensionList().stream()
.filter(gridDimensionType -> gridDimensionType.getRank() != null)
.anyMatch(gridDimensionType -> 1 == gridDimensionType.getRank().intValue());
if (! hasRank1Dimension)
throw new IllegalDDIElementException(
"DDI dynamic table question '" + ddiDynamicTableQuestion.getIDArray(0).getStringValue() +
"' has no rank 1 dimension.");
private static GridDimensionType checkRank1Dimension(QuestionGridType ddiDynamicTableQuestion) {
return ddiDynamicTableQuestion.getGridDimensionList().stream()
.filter(gridDimensionType -> BigInteger.ONE.equals(gridDimensionType.getRank()))
.findAny()
.orElseThrow(() -> new IllegalDDIElementException(
"DDI dynamic table question '" + ddiDynamicTableQuestion.getIDArray(0).getStringValue() +
"' has no rank 1 dimension."));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ else if (enoTable.getSizeExpression() != null)
private static void setMinMaxProperties(DynamicTableQuestion enoTable, LinesRoster lines) {
LabelType minLabel = new LabelType();
minLabel.setType(LabelTypeEnum.VTL);
minLabel.setValue(Integer.toString(enoTable.getMinLines().intValue()));
minLabel.setValue(enoTable.getMinLines().toString());
lines.setMin(minLabel);

LabelType maxLabel = new LabelType();
maxLabel.setType(LabelTypeEnum.VTL);
maxLabel.setValue(Integer.toString(enoTable.getMaxLines().intValue()));
maxLabel.setValue(enoTable.getMaxLines().toString());
lines.setMax(maxLabel);
}

Expand Down
15 changes: 10 additions & 5 deletions eno-core/src/main/java/fr/insee/eno/core/utils/LunaticUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,13 @@ public static List<String> getCollectedVariablesInLoop(Loop loop) {
List<String> result = new ArrayList<>();
loop.getComponents().forEach(component -> {
switch (component.getComponentType()) {
case CHECKBOX_BOOLEAN, INPUT_NUMBER, INPUT, TEXTAREA, DATEPICKER, RADIO, CHECKBOX_ONE, DROPDOWN,
CHECKBOX_GROUP, TABLE ->
case CHECKBOX_BOOLEAN, INPUT_NUMBER, INPUT, TEXTAREA, SUGGESTER, DATEPICKER, DURATION, RADIO,
CHECKBOX_ONE, DROPDOWN, CHECKBOX_GROUP, TABLE ->
result.addAll(getDirectResponseNames(component));
case QUESTIONNAIRE, SEQUENCE, SUBSEQUENCE, TEXT, ACCORDION ->
doNothing();
case QUESTION ->
throw new IllegalStateException("This method does not support the question component.");
case ROSTER_FOR_LOOP ->
throw new LunaticLoopException(String.format(
"Dynamic tables are forbidden in loops: loop '%s' contains a dynamic table.",
Expand All @@ -132,14 +136,15 @@ public static List<String> getCollectedVariablesInLoop(Loop loop) {
throw new LunaticLoopException(String.format(
"Pairwise components are forbidden in loops: loop '%s' contains a pairwise component.",
loop.getId()));
default ->
log.debug("(Variables in Lunatic loop) Component of type {} has no response.",
component.getComponentType());
}
});
return result;
}

private static void doNothing() {
/* No-op method */
}

/**
* Return the response name of the component that belong to the given pairwise links. This method checks if
* the inner component is valid.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ void simpleResponseComponents_resizedVariables() {
input.setResponse(new ResponseType());
input.getResponse().setName("INPUT_VAR");
lunaticLoop.getComponents().add(input);
Suggester suggester = new Suggester(); // The suggester component type is set by the constructor
suggester.setResponse(new ResponseType());
suggester.getResponse().setName("SUGGESTER_VAR");
lunaticLoop.getComponents().add(suggester);
Textarea textarea = new Textarea();
textarea.setComponentType(ComponentTypeEnum.TEXTAREA);
textarea.setResponse(new ResponseType());
Expand All @@ -136,6 +140,11 @@ void simpleResponseComponents_resizedVariables() {
datepicker.setResponse(new ResponseType());
datepicker.getResponse().setName("DATE_VAR");
lunaticLoop.getComponents().add(datepicker);
Duration duration = new Duration();
duration.setComponentType(ComponentTypeEnum.DURATION);
duration.setResponse(new ResponseType());
duration.getResponse().setName("DURATION_VAR");
lunaticLoop.getComponents().add(duration);
Dropdown dropdown = new Dropdown();
dropdown.setComponentType(ComponentTypeEnum.DROPDOWN);
dropdown.setResponse(new ResponseType());
Expand All @@ -160,8 +169,8 @@ void simpleResponseComponents_resizedVariables() {
// Then
assertThat(lunaticResizing.getResizingEntry("LOOP_SIZE_VAR").getVariables())
.containsExactlyInAnyOrderElementsOf(Set.of(
"BOOLEAN_VAR", "INPUT_VAR", "TEXT_VAR", "NUMBER_VAR", "DATE_VAR",
"DROPDOWN_VAR", "RADIO_VAR", "CHECKBOX_VAR"));
"BOOLEAN_VAR", "INPUT_VAR", "SUGGESTER_VAR", "TEXT_VAR", "NUMBER_VAR",
"DATE_VAR", "DURATION_VAR", "DROPDOWN_VAR", "RADIO_VAR", "CHECKBOX_VAR"));
}

@Test
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down

0 comments on commit 5ba4300

Please sign in to comment.