Skip to content

Commit

Permalink
Merge branch 'db-outreach-display' into db-task-assign-individual
Browse files Browse the repository at this point in the history
  • Loading branch information
devonbush authored Jun 30, 2024
2 parents cd86ba7 + f2abf61 commit 1c05784
Show file tree
Hide file tree
Showing 19 changed files with 184 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ public class EnrolleePopDto extends Enrollee implements TimeShiftable {
private boolean withdrawn = false;
private PreEnrollmentResponsePopDto preEnrollmentResponseDto;

private Set<SurveyResponsePopDto> surveyResponseDtos = new HashSet<>();
private Set<ParticipantTaskPopDto> participantTaskDtos = new HashSet<>();
private List<SurveyResponsePopDto> surveyResponseDtos = new ArrayList<>();
private List<ParticipantTaskPopDto> participantTaskDtos = new ArrayList<>();
private List<NotificationPopDto> notifications = new ArrayList<>();
private List<ParticipantNotePopDto> participantNoteDtos = new ArrayList<>();
private Integer submittedHoursAgo;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ private void populateResponse(Enrollee enrollee, SurveyResponsePopDto responsePo
} else {
responsibleUser = new ResponsibleEntity(pUser);
}
Survey survey = surveyService.findByStableIdAndPortalShortcodeWithMappings(context.applyShortcodeOverride(responsePopDto.getSurveyStableId()),
Survey survey = surveyService.findByStableIdAndPortalShortcodeWithMappings(responsePopDto.getSurveyStableId(),
responsePopDto.getSurveyVersion(), context.getPortalShortcode()).orElseThrow(() -> new NotFoundException("Survey not found " + context.applyShortcodeOverride(responsePopDto.getSurveyStableId())));

SurveyResponseWithJustification response = SurveyResponseWithJustification.builder()
Expand Down Expand Up @@ -177,7 +177,8 @@ private void populateResponse(Enrollee enrollee, SurveyResponsePopDto responsePo
SurveyResponse savedResponse;
if (simulateSubmissions) {
ParticipantTask task = participantTaskService
.findTaskForActivity(ppUser.getId(), enrollee.getStudyEnvironmentId(), survey.getStableId()).get();
.findTaskForActivity(ppUser.getId(), enrollee.getStudyEnvironmentId(), survey.getStableId()).get();

if (responsePopDto.getSurveyVersion() != task.getTargetAssignedVersion()) {
/**
* in simulateSubmission mode, tasks will be automatically created with the curren versions of the survey.
Expand Down Expand Up @@ -226,7 +227,7 @@ private PreEnrollmentResponse populatePreEnrollResponse(EnrolleePopDto enrolleeD
if (responsePopDto == null) {
return null;
}
Survey survey = surveyService.findByStableIdAndPortalShortcode(context.applyShortcodeOverride(responsePopDto.getSurveyStableId()),
Survey survey = surveyService.findByStableIdAndPortalShortcode(responsePopDto.getSurveyStableId(),
responsePopDto.getSurveyVersion(), context.getPortalShortcode()).get();
String fullData = objectMapper.writeValueAsString(responsePopDto.getAnswers());
PreEnrollmentResponse response = PreEnrollmentResponse.builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ private void postProcessStudyEnv(StudyEnvironmentPopDto studyPopEnv, StudyPopula

// save any of the pre-enrollment responses that aren't associated with an enrollee
for (PreEnrollmentResponsePopDto responsePopDto : studyPopEnv.getPreEnrollmentResponseDtos()) {
Survey survey = surveyService.findByStableIdAndPortalShortcode(context.applyShortcodeOverride(responsePopDto.getSurveyStableId()),
Survey survey = surveyService.findByStableIdAndPortalShortcode(responsePopDto.getSurveyStableId(),
responsePopDto.getSurveyVersion(), context.getPortalShortcode()).get();
String fullData = objectMapper.writeValueAsString(responsePopDto.getAnswers());
PreEnrollmentResponse response = PreEnrollmentResponse.builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ public SurveyPopulator(SurveyService surveyService,
protected void preProcessDto(SurveyPopDto popDto, PortalPopulateContext context) {
UUID portalId = portalService.findOneByShortcode(context.getPortalShortcode()).get().getId();
popDto.setPortalId(portalId);
popDto.setStableId(context.applyShortcodeOverride(popDto.getStableId()));
String newContent = popDto.getJsonContent().toString();
popDto.setContent(newContent);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"participantUser": {
"username": "lostInterestNo@test.com",
"lastLoginHoursAgo": 45
},
"profile": {
"givenName": "Lost",
"familyName": "InterestNoFollow",
"contactEmail": "lostInterestNo@test.com",
"sexAtBirth": "male",
"mailingAddress": {
"street1": "446 Spruce Street",
"city": "New York",
"state": "NY",
"country": "US",
"postalCode": "10006"
}
}
}
3 changes: 2 additions & 1 deletion populate/src/main/resources/seed/portals/demo/portal.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@
"participants/proxyFamily2.json",
"participants/invited.json",
"participants/unenrolled.json",
"participants/lostInterest.json"
"participants/lostInterest.json",
"participants/lostInterestNo.json"
],
"mailingListContacts": [
{
Expand Down
Loading

0 comments on commit 1c05784

Please sign in to comment.