diff --git a/pom.xml b/pom.xml
index 5a346d60..178b671b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -9,7 +9,7 @@
fr.insee.survey
platine-management
- 1.0.22
+ 1.0.23
platine-management
REST API for communication between DB and Platine-Management UI and Platine-My-Surveys UI
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/service/impl/CampaignServiceImpl.java b/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/service/impl/CampaignServiceImpl.java
index 994a9f8b..9b0b0047 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/service/impl/CampaignServiceImpl.java
+++ b/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/service/impl/CampaignServiceImpl.java
@@ -41,7 +41,7 @@ public class CampaignServiceImpl implements CampaignService {
public Collection getCampaigns() {
List moogCampaigns = new ArrayList<>();
- List campaigns = campaignRepository.findAll();
+ List campaigns = campaignRepository.findAll().stream().filter(c -> !c.getPartitionings().isEmpty()).toList();
for (Campaign campaign : campaigns) {
CampaignMoogDto campaignMoogDto = new CampaignMoogDto();
@@ -49,16 +49,17 @@ public Collection getCampaigns() {
campaignMoogDto.setLabel(campaign.getCampaignWording());
Optional dateMin = campaign.getPartitionings().stream().map(Partitioning::getOpeningDate)
- .collect(Collectors.toList()).stream()
.min(Comparator.comparing(Date::getTime));
Optional dateMax = campaign.getPartitionings().stream().map(Partitioning::getClosingDate)
- .collect(Collectors.toList()).stream()
.max(Comparator.comparing(Date::getTime));
- campaignMoogDto.setCollectionStartDate(dateMin.get().getTime());
- campaignMoogDto.setCollectionEndDate(dateMax.get().getTime());
-
- moogCampaigns.add(campaignMoogDto);
+ if (dateMin.isPresent() && dateMax.isPresent()) {
+ campaignMoogDto.setCollectionStartDate(dateMin.get().getTime());
+ campaignMoogDto.setCollectionEndDate(dateMax.get().getTime());
+ moogCampaigns.add(campaignMoogDto);
+ } else {
+ log.warn("No start date or end date found for campaign {}", campaign.getId());
+ }
}
return moogCampaigns;
}
@@ -146,7 +147,7 @@ public boolean isCampaignOngoing(String idCampaign) throws NotFoundException {
LOGGER.info("Partitiong {} of campaign {} is closed", part.getId(), idCampaign);
}
}
- return camp.get().getPartitionings().size() != 0 && nbOnGoingParts == camp.get().getPartitionings().size();
+ return !camp.get().getPartitionings().isEmpty() && nbOnGoingParts == camp.get().getPartitionings().size();
}
}
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/query/controller/WebclientController.java b/src/main/java/fr/insee/survey/datacollectionmanagement/query/controller/WebclientController.java
index 1977adf4..e159b531 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/query/controller/WebclientController.java
+++ b/src/main/java/fr/insee/survey/datacollectionmanagement/query/controller/WebclientController.java
@@ -597,7 +597,9 @@ private SupportDto convertToDto(Support support) {
}
private ContactDto convertToDto(Contact contact) {
- return modelMapper.map(contact, ContactDto.class);
+ ContactDto contactDto = modelMapper.map(contact, ContactDto.class);
+ contactDto.setCivility(contact.getGender());
+ return contactDto;
}
private SurveyUnitDto convertToDto(SurveyUnit surveyUnit) {