Skip to content

Commit

Permalink
fix: identification DTO attribute without _underscores_, questions wi…
Browse files Browse the repository at this point in the history
…th _underscore_
  • Loading branch information
SimonDmz committed Dec 20, 2024
1 parent 0839cfc commit 5e824ab
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 26 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package fr.insee.pearljam.api.surveyunit.dto;

import com.fasterxml.jackson.annotation.JsonProperty;
import fr.insee.pearljam.domain.surveyunit.model.Identification;
import fr.insee.pearljam.domain.surveyunit.model.question.*;

Expand All @@ -10,15 +9,10 @@ public record IdentificationDto(
SituationQuestionValue situation,
CategoryQuestionValue category,
OccupantQuestionValue occupant,
@JsonProperty("individual_status")
IndividualStatusQuestionValue individualStatus,
@JsonProperty("interviewer_can_process")
InterviewerCanProcessQuestionValue interviewerCanProcess,
@JsonProperty("number_of_respondents")
NumberOfRespondentsQuestionValue numberOfRespondents,
@JsonProperty("present_in_previous_home")
PresentInPreviousHomeQuestionValue presentInPreviousHome,
@JsonProperty("household_composition")
HouseholdCompositionQuestionValue householdComposition
) {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package fr.insee.pearljam.domain.surveyunit.model.question;

public enum HouseholdCompositionQuestionValue {
SAMECOMPO, OTHERCOMPO
SAME_COMPO, OTHER_COMPO
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package fr.insee.pearljam.domain.surveyunit.model.question;

public enum IndividualStatusQuestionValue {
DCD, NOIDENT, NOFIELD, SAMEADDRESS, OTHERADDRESS
DCD, NOIDENT, NOFIELD, SAME_ADDRESS, OTHER_ADDRESS
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package fr.insee.pearljam.domain.surveyunit.model.question;

public enum PresentInPreviousHomeQuestionValue {
ATLEASTONE, NONE
AT_LEAST_ONE, NONE
}
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 @@ -197,7 +197,7 @@ INSERT INTO closing_cause (date, type, survey_unit_id) VALUES


INSERT INTO public.identification (survey_unit_id, identification,access,situation,category,occupant,individual_status,interviewer_can_process,number_of_respondents,present_in_previous_home,household_composition) VALUES
('11', 'IDENTIFIED', 'ACC', 'ORDINARY', 'PRIMARY', 'IDENTIFIED','SAMEADDRESS','YES','MANY','ATLEASTONE','SAMECOMPO'),
('11', 'IDENTIFIED', 'ACC', 'ORDINARY', 'PRIMARY', 'IDENTIFIED','SAME_ADDRESS','YES','MANY','AT_LEAST_ONE','SAME_COMPO'),
('21', 'IDENTIFIED', 'ACC', 'ORDINARY', 'PRIMARY', 'IDENTIFIED', null, null, null, null, null);

INSERT INTO public.communication_template (meshuggah_id, medium, type, campaign_id) VALUES
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,11 +237,11 @@ void testUpdateIdentification01() {
SituationQuestionValue.NOORDINARY,
CategoryQuestionValue.VACANT,
OccupantQuestionValue.UNIDENTIFIED,
IndividualStatusQuestionValue.OTHERADDRESS,
IndividualStatusQuestionValue.OTHER_ADDRESS,
InterviewerCanProcessQuestionValue.NO,
NumberOfRespondentsQuestionValue.MANY,
PresentInPreviousHomeQuestionValue.NONE,
HouseholdCompositionQuestionValue.OTHERCOMPO
HouseholdCompositionQuestionValue.OTHER_COMPO
);
surveyUnitDto = createSurveyUnitDto(identification, null, null);

Expand All @@ -253,11 +253,11 @@ void testUpdateIdentification01() {
assertThat(identificationResult.getSituation()).isEqualTo(SituationQuestionValue.NOORDINARY);
assertThat(identificationResult.getCategory()).isEqualTo(CategoryQuestionValue.VACANT);
assertThat(identificationResult.getOccupant()).isEqualTo(OccupantQuestionValue.UNIDENTIFIED);
assertThat(identificationResult.getIndividualStatus()).isEqualTo(IndividualStatusQuestionValue.OTHERADDRESS);
assertThat(identificationResult.getIndividualStatus()).isEqualTo(IndividualStatusQuestionValue.OTHER_ADDRESS);
assertThat(identificationResult.getInterviewerCanProcess()).isEqualTo(InterviewerCanProcessQuestionValue.NO);
assertThat(identificationResult.getNumberOfRespondents()).isEqualTo(NumberOfRespondentsQuestionValue.MANY);
assertThat(identificationResult.getPresentInPreviousHome()).isEqualTo(PresentInPreviousHomeQuestionValue.NONE);
assertThat(identificationResult.getHouseholdComposition()).isEqualTo(HouseholdCompositionQuestionValue.OTHERCOMPO);
assertThat(identificationResult.getHouseholdComposition()).isEqualTo(HouseholdCompositionQuestionValue.OTHER_COMPO);
assertThat(identificationResult.getSurveyUnit()).isEqualTo(surveyUnit);
}

Expand All @@ -280,11 +280,11 @@ void testUpdateIdentification03() {
SituationQuestionValue.NOORDINARY,
CategoryQuestionValue.VACANT,
OccupantQuestionValue.UNIDENTIFIED,
IndividualStatusQuestionValue.OTHERADDRESS,
IndividualStatusQuestionValue.OTHER_ADDRESS,
InterviewerCanProcessQuestionValue.NO,
NumberOfRespondentsQuestionValue.MANY,
PresentInPreviousHomeQuestionValue.NONE,
HouseholdCompositionQuestionValue.OTHERCOMPO);
HouseholdCompositionQuestionValue.OTHER_COMPO);
surveyUnitDto = createSurveyUnitDto(identification, null, null);

surveyUnitService.updateSurveyUnitInfos(surveyUnit, surveyUnitDto);
Expand All @@ -297,11 +297,11 @@ void testUpdateIdentification03() {
assertThat(identificationResult.getCategory()).isEqualTo(CategoryQuestionValue.VACANT);
assertThat(identificationResult.getOccupant()).isEqualTo(OccupantQuestionValue.UNIDENTIFIED);
assertThat(identificationResult.getSurveyUnit()).isEqualTo(surveyUnit);
assertThat(identificationResult.getIndividualStatus()).isEqualTo(IndividualStatusQuestionValue.OTHERADDRESS);
assertThat(identificationResult.getIndividualStatus()).isEqualTo(IndividualStatusQuestionValue.OTHER_ADDRESS);
assertThat(identificationResult.getInterviewerCanProcess()).isEqualTo(InterviewerCanProcessQuestionValue.NO);
assertThat(identificationResult.getNumberOfRespondents()).isEqualTo(NumberOfRespondentsQuestionValue.MANY);
assertThat(identificationResult.getPresentInPreviousHome()).isEqualTo(PresentInPreviousHomeQuestionValue.NONE);
assertThat(identificationResult.getHouseholdComposition()).isEqualTo(HouseholdCompositionQuestionValue.OTHERCOMPO);
assertThat(identificationResult.getHouseholdComposition()).isEqualTo(HouseholdCompositionQuestionValue.OTHER_COMPO);
}

private SurveyUnitUpdateDto createSurveyUnitDto(IdentificationDto identification, List<CommentDto> comments, List<CommunicationRequestCreateDto> communicationRequests) {
Expand All @@ -316,11 +316,11 @@ private IdentificationDB createIdentificationDB() {
SituationQuestionValue.ORDINARY,
CategoryQuestionValue.SECONDARY,
OccupantQuestionValue.IDENTIFIED,
IndividualStatusQuestionValue.SAMEADDRESS,
IndividualStatusQuestionValue.SAME_ADDRESS,
InterviewerCanProcessQuestionValue.YES,
NumberOfRespondentsQuestionValue.ONE,
PresentInPreviousHomeQuestionValue.ATLEASTONE,
HouseholdCompositionQuestionValue.SAMECOMPO,
PresentInPreviousHomeQuestionValue.AT_LEAST_ONE,
HouseholdCompositionQuestionValue.SAME_COMPO,
surveyUnit);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -237,11 +237,11 @@ void testGetSurveyUnitDetail() throws Exception {
"situation":"ORDINARY",
"category":"PRIMARY",
"occupant":"IDENTIFIED",
"individual_status":"SAMEADDRESS",
"interviewer_can_process":"YES",
"number_of_respondents":"MANY",
"present_in_previous_home":"ATLEASTONE",
"household_composition":"SAMECOMPO"
"individualStatus":"SAME_ADDRESS",
"interviewerCanProcess":"YES",
"numberOfRespondents":"MANY",
"presentInPreviousHome":"AT_LEAST_ONE",
"householdComposition":"SAME_COMPO"
},
"communicationTemplates":[
{
Expand Down

0 comments on commit 5e824ab

Please sign in to comment.