Skip to content

Commit

Permalink
fix: had survey unit questioning informations
Browse files Browse the repository at this point in the history
  • Loading branch information
BettyB979 committed Aug 7, 2024
1 parent 44a85b8 commit ba51614
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import fr.insee.survey.datacollectionmanagement.questioning.dto.SurveyUnitDetailsDto;
import fr.insee.survey.datacollectionmanagement.questioning.dto.SurveyUnitDto;
import fr.insee.survey.datacollectionmanagement.questioning.service.SurveyUnitService;
import fr.insee.survey.datacollectionmanagement.view.service.ViewService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.ArraySchema;
import io.swagger.v3.oas.annotations.media.Content;
Expand Down Expand Up @@ -42,6 +43,7 @@
public class SurveyUnitController {

private final SurveyUnitService surveyUnitService;
private final ViewService viewService;
private final ModelMapper modelMapper;

@Operation(summary = "Search for a survey units, paginated")
Expand All @@ -51,7 +53,7 @@ public class SurveyUnitController {
@ApiResponse(responseCode = "404", description = "Not found"),
@ApiResponse(responseCode = "400", description = "Bad Request")
})
@Deprecated
@Deprecated(since="2.6.0", forRemoval=true)
public Page<SurveyUnitDto> getSurveyUnits(
@RequestParam(defaultValue = "0") Integer page,
@RequestParam(defaultValue = "20") Integer size,
Expand Down Expand Up @@ -87,7 +89,9 @@ public Page<SearchSurveyUnitDto> searchSurveyUnits(
})
public SurveyUnitDetailsDto findSurveyUnit(@PathVariable("id") String id) {
SurveyUnit surveyUnit = surveyUnitService.findbyId(StringUtils.upperCase(id));
return convertToDetailsDto(surveyUnit);
SurveyUnitDetailsDto surveyUnitDetailsDto = convertToDetailsDto(surveyUnit);
surveyUnitDetailsDto.setHasQuestionings(!viewService.findViewByIdSu(id).isEmpty());
return surveyUnitDetailsDto;

}

Expand Down Expand Up @@ -132,7 +136,7 @@ public ResponseEntity<SurveyUnitDto> putSurveyUnit(@PathVariable("id") String id
@ApiResponse(responseCode = "404", description = "Not found"),
@ApiResponse(responseCode = "400", description = "Bad request")
})
@Deprecated
@Deprecated(since="2.6.0", forRemoval=true)
public void deleteSurveyUnit(@PathVariable("id") String id) {
SurveyUnit surveyUnit = surveyUnitService.findbyId(StringUtils.upperCase(id));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public class SurveyUnitDetailsDto {
private String identificationCode;
private String identificationName;
private SurveyUnitAddressDto address;
private boolean hasQuestionings;
private Set<SurveyUnitCommentOutputDto> comments;

}

0 comments on commit ba51614

Please sign in to comment.