Skip to content

Commit

Permalink
Merge pull request #191 from InseeFr/fix-surveyunit-visibility
Browse files Browse the repository at this point in the history
fix: add use letter communication in survey unit visibility
  • Loading branch information
EricThuaud authored Oct 2, 2024
2 parents ca62972 + 5862ad2 commit 1a6a9c5
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 34 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<groupId>fr.insee.pearljam</groupId>
<artifactId>pearljam-back-office</artifactId>
<version>5.1.4</version>
<version>5.1.5</version>
<name>Pearl-Jam-Back-Office</name>
<description>Back-office services for PearlJam</description>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import fr.insee.pearljam.api.domain.ContactAttemptConfiguration;
import fr.insee.pearljam.api.domain.ContactOutcomeConfiguration;
import fr.insee.pearljam.api.domain.IdentificationConfiguration;
import fr.insee.pearljam.api.domain.SurveyUnit;
import fr.insee.pearljam.api.dto.address.AddressDto;
import fr.insee.pearljam.api.dto.campaign.CampaignDto;
import fr.insee.pearljam.api.dto.person.PersonDto;
Expand Down Expand Up @@ -67,35 +66,12 @@ public class SurveyUnitDto {
private IdentificationConfiguration identificationConfiguration;
private ContactOutcomeConfiguration contactOutcomeConfiguration;
private ContactAttemptConfiguration contactAttemptConfiguration;
private boolean useLetterCommunication;

private List<PersonDto> persons;

private AddressDto address;

public SurveyUnitDto() {
}

public SurveyUnitDto(SurveyUnit su, SurveyUnitVisibilityDto visibility, Boolean extended) {
this.id = su.getId();
this.campaign = su.getCampaign().getId();
this.campaignLabel = su.getCampaign().getLabel();
this.managementStartDate = visibility.managementStartDate();
this.interviewerStartDate = visibility.interviewerStartDate();
this.identificationPhaseStartDate = visibility.identificationPhaseStartDate();
this.collectionStartDate = visibility.collectionStartDate();
this.collectionEndDate = visibility.collectionEndDate();
this.endDate = visibility.endDate();
this.identificationConfiguration = su.getCampaign().getIdentificationConfiguration();
this.contactAttemptConfiguration = su.getCampaign().getContactAttemptConfiguration();
this.contactOutcomeConfiguration = su.getCampaign().getContactOutcomeConfiguration();
if (Boolean.TRUE.equals(extended)) {
this.persons = su.getPersons().stream()
.map(PersonDto::new)
.toList();
this.address = new AddressDto(su.getAddress());
}
}

public SurveyUnitDto(String idSurveyUnit, CampaignDto campaign, SurveyUnitVisibilityDto visibility) {
this.id = idSurveyUnit;
this.campaign = campaign.getId();
Expand All @@ -106,6 +82,7 @@ public SurveyUnitDto(String idSurveyUnit, CampaignDto campaign, SurveyUnitVisibi
this.collectionStartDate = visibility.collectionStartDate();
this.collectionEndDate = visibility.collectionEndDate();
this.endDate = visibility.endDate();
this.useLetterCommunication = visibility.useLetterCommunication();
this.identificationConfiguration = campaign.getIdentificationConfiguration();
this.contactAttemptConfiguration = campaign.getContactAttemptConfiguration();
this.contactOutcomeConfiguration = campaign.getContactOutcomeConfiguration();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ public record SurveyUnitVisibilityDto(
Long identificationPhaseStartDate,
Long collectionStartDate,
Long collectionEndDate,
Long endDate
Long endDate,
boolean useLetterCommunication
) {

public static SurveyUnitVisibilityDto fromModel(Visibility visibility) {
Expand All @@ -30,6 +31,7 @@ public static SurveyUnitVisibilityDto fromModel(Visibility visibility) {
visibility.identificationPhaseStartDate(),
visibility.collectionStartDate(),
visibility.collectionEndDate(),
visibility.endDate());
visibility.endDate(),
visibility.useLetterCommunication());
}
}
2 changes: 1 addition & 1 deletion src/main/resources/db/dataset/reinit-test-data.sql
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ INSERT INTO visibility (
) VALUES
('OU-NORTH', 'SIMPSONS2020X00',1721903754305, 1719225354304, 1724582154306, 1719138954303, 1719052554302, 1718966154301, true),
('OU-SOUTH', 'SIMPSONS2020X00',1721903754315, 1719225354314, 1724582154316, 1719138954310, 1719052554309, 1718966154308, false),
('OU-NORTH', 'VQS2021X00',1721903754308, 1719225354308, 1724582154308, 1719138954308, 1719052554308, 1718966154308, true),
('OU-NORTH', 'VQS2021X00',1721903754308, 1719225354308, 1724582154308, 1719138954308, 1719052554308, 1718966154308, false),
('OU-SOUTH', 'VQS2021X00',1721903754308, 1719225354308, 1724582154308, 1719138954308, 1719052554308, 1718966154308, true),
('OU-SOUTH', 'XCLOSEDX00',1719052554308, 1718966154308, 1719225354308, 1718879754308, 1718789354308, 1718706954308, true),
('OU-SOUTH', 'ZCLOSEDX00',1719052554308, 1718966154308, 1719225354308, 1718879754308, 1718789354308, 1718706954308, true),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ void testGetAllSurveyUnits() throws Exception {
"endDate":1724582154306,
"identificationConfiguration":"IASCO",
"contactOutcomeConfiguration":"F2F",
"contactAttemptConfiguration":"F2F"
"contactAttemptConfiguration":"F2F",
"useLetterCommunication": true
},
{
"id":"12",
Expand All @@ -84,7 +85,8 @@ void testGetAllSurveyUnits() throws Exception {
"endDate":1724582154306,
"identificationConfiguration":"IASCO",
"contactOutcomeConfiguration":"F2F",
"contactAttemptConfiguration":"F2F"
"contactAttemptConfiguration":"F2F",
"useLetterCommunication": true
},
{
"id":"20",
Expand All @@ -98,7 +100,8 @@ void testGetAllSurveyUnits() throws Exception {
"endDate":1724582154308,
"identificationConfiguration":"IASCO",
"contactOutcomeConfiguration":"TEL",
"contactAttemptConfiguration":"TEL"
"contactAttemptConfiguration":"TEL",
"useLetterCommunication": false
}
]
""";
Expand Down Expand Up @@ -387,7 +390,7 @@ void testPutSurveyUnitDetail() throws Exception {
},
"communicationRequests":[
{
"communicationTemplateId":4,
"communicationTemplateId":5,
"reason":"REFUSAL",
"creationTimestamp": 1721903754305
},
Expand Down Expand Up @@ -499,7 +502,7 @@ void testPutSurveyUnitDetail() throws Exception {
},
"communicationRequests":[
{
"communicationTemplateId":4,
"communicationTemplateId":5,
"reason":"REFUSAL",
"emitter":"INTERVIEWER",
"status":[
Expand Down

0 comments on commit 1a6a9c5

Please sign in to comment.