Skip to content

Commit

Permalink
Fix for started saga
Browse files Browse the repository at this point in the history
  • Loading branch information
arcshiftsolutions committed Nov 23, 2023
1 parent 666288b commit 7ca4f6d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public List<SagaEntity> writeNewSagaRecordsForProcessing(List<OnboardingFileRow>
var district = districtMap.get(onboardingFileRow.getMincode());
if (district != null) {
log.info("Writing onboarding saga record for district number :: " + onboardingFileRow.getMincode());
var sagaRecord = prepareSagaRecord(onboardingFileRow, createUser, UUID.fromString(district.getDistrictId()), null);
var sagaRecord = prepareSagaRecord(onboardingFileRow, createUser, UUID.fromString(district.getDistrictId()), null, district.getDisplayName());
sagaEntities.add(sagaService.createSagaRecord(sagaRecord));
} else {
log.info("Skipped district code :: " + onboardingFileRow.getMincode() + " :: no district was found in the cache containing this value");
Expand All @@ -84,7 +84,7 @@ public List<SagaEntity> writeNewSagaRecordsForProcessing(List<OnboardingFileRow>
var school = schoolMap.get(onboardingFileRow.getMincode());
if (school != null) {
log.info("Writing onboarding saga record for school mincode :: " + onboardingFileRow.getMincode());
var sagaRecord = prepareSagaRecord(onboardingFileRow, createUser, null, UUID.fromString(school.getSchoolId()));
var sagaRecord = prepareSagaRecord(onboardingFileRow, createUser, null, UUID.fromString(school.getSchoolId()), school.getDisplayName());
sagaEntities.add(sagaService.createSagaRecord(sagaRecord));
} else {
log.info("Skipped school mincode :: " + onboardingFileRow.getMincode() + " :: no school was found in the cache containing this value");
Expand All @@ -97,7 +97,7 @@ public List<SagaEntity> writeNewSagaRecordsForProcessing(List<OnboardingFileRow>
return sagaEntities;
}

private SagaEntity prepareSagaRecord(final OnboardingFileRow onboardingFileRow, final String createUser, UUID districtID, UUID schoolID) throws JsonProcessingException {
private SagaEntity prepareSagaRecord(final OnboardingFileRow onboardingFileRow, final String createUser, UUID districtID, UUID schoolID, String displayName) throws JsonProcessingException {
SagaEntityBuilder builder = SagaEntity.builder()
.createUser(createUser)
.updateUser(createUser)
Expand All @@ -116,6 +116,7 @@ private SagaEntity prepareSagaRecord(final OnboardingFileRow onboardingFileRow,
payload.setLastName(onboardingFileRow.getLastName());
payload.setEmail(onboardingFileRow.getEmail());
payload.setMincode(onboardingFileRow.getMincode());
payload.setSchoolName(displayName);
payload.setSchoolID(schoolID);
builder.sagaName(ONBOARD_SCHOOL_USER_SAGA.toString());
builder.payload(JsonUtil.getJsonStringFromObject(payload));
Expand All @@ -125,6 +126,7 @@ private SagaEntity prepareSagaRecord(final OnboardingFileRow onboardingFileRow,
payload.setLastName(onboardingFileRow.getLastName());
payload.setEmail(onboardingFileRow.getEmail());
payload.setMincode(onboardingFileRow.getMincode());
payload.setDistrictName(displayName);
payload.setDistrictID(districtID);
builder.sagaName(ONBOARD_DISTRICT_USER_SAGA.toString());
builder.payload(JsonUtil.getJsonStringFromObject(payload));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,7 @@ public void sendPrimaryActivationCodeNotification(OnboardSchoolUserSagaData saga

Optional<EdxActivationCodeEntity> edxActivationCodeEntity =
edxActivationCodeRepository.findEdxActivationCodeEntitiesBySchoolIDAndIsPrimaryTrueAndDistrictIDIsNull(schoolId);
final String recipient = (sagaData.getFirstName()
+ " " + sagaData.getLastName()).trim();
final String recipient = (sagaData.getFirstName() + " " + sagaData.getLastName()).trim();

EmailNotification emailNotification = EmailNotification.builder()
.fromEmail(this.emailProperties.getEdxSchoolUserActivationInviteEmailFrom())
Expand Down

0 comments on commit 7ca4f6d

Please sign in to comment.