Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: duration components in resizing #1159

Merged
merged 3 commits into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -117,8 +117,8 @@ 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, DATEPICKER, DURATION, RADIO,
CHECKBOX_ONE, DROPDOWN, CHECKBOX_GROUP, TABLE ->
result.addAll(getDirectResponseNames(component));
case ROSTER_FOR_LOOP ->
throw new LunaticLoopException(String.format(
Expand All @@ -133,8 +133,8 @@ public static List<String> getCollectedVariablesInLoop(Loop loop) {
"Pairwise components are forbidden in loops: loop '%s' contains a pairwise component.",
loop.getId()));
default ->
FBibonne marked this conversation as resolved.
Show resolved Hide resolved
log.debug("(Variables in Lunatic loop) Component of type {} has no response.",
component.getComponentType());
throw new IllegalArgumentException(
"Unexpected component type '" + component.getComponentType() + "'.");
}
});
return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,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,7 +165,7 @@ void simpleResponseComponents_resizedVariables() {
// Then
assertThat(lunaticResizing.getResizingEntry("LOOP_SIZE_VAR").getVariables())
.containsExactlyInAnyOrderElementsOf(Set.of(
"BOOLEAN_VAR", "INPUT_VAR", "TEXT_VAR", "NUMBER_VAR", "DATE_VAR",
"BOOLEAN_VAR", "INPUT_VAR", "TEXT_VAR", "NUMBER_VAR", "DATE_VAR", "DURATION_VAR",
"DROPDOWN_VAR", "RADIO_VAR", "CHECKBOX_VAR"));
}

Expand Down
Loading