Skip to content

Commit

Permalink
LMSA-9020 - changes made after code review
Browse files Browse the repository at this point in the history
  • Loading branch information
iudsobiera committed Sep 14, 2023
1 parent ed0b15a commit cb4bf83
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -403,8 +403,6 @@ public String doContinue(@PathVariable("courseId") String courseId, @RequestPara

// if the current course has etexts, check to see if the wanted crosslisted sections have the same etexts
List<String> missingEtextSections = new ArrayList<>();
List<SectionUIDisplay> addList = sectionWrapper.getAddList();
List<SectionUIDisplay> finalList = sectionWrapper.getFinalList();

for (SectionUIDisplay sectionUIDisplay : sectionWrapper.getAddList()) {
String sectionUIDisplaySectionName = sectionUIDisplay.getSectionName();
Expand All @@ -418,8 +416,8 @@ public String doContinue(@PathVariable("courseId") String courseId, @RequestPara
}

if (! crosslistService.canCoursesBeCrosslistedBasedOnEtexts(currentCourse.getSisCourseId(), sectionUIDisplaySectionName)) {
sectionWrapper.setAddList(removeSectionUiDisplayBySectionName(addList, sectionUIDisplay.getSectionName()));
sectionWrapper.setFinalList(removeSectionUiDisplayBySectionName(finalList, sectionUIDisplay.getSectionName()));
sectionWrapper.setAddList(removeSectionUiDisplayBySectionName(sectionWrapper.getAddList(), sectionUIDisplay.getSectionName()));
sectionWrapper.setFinalList(removeSectionUiDisplayBySectionName(sectionWrapper.getFinalList(), sectionUIDisplay.getSectionName()));
uncheckSectionUiDisplayBySectionId(sectionUIDisplay.getSectionId(), sectionList);

missingEtextSections.add(sectionUIDisplay.getSectionName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
import java.time.LocalDate;
import java.time.ZoneId;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
Expand Down Expand Up @@ -368,28 +369,15 @@ public boolean canCoursesBeCrosslistedBasedOnEtexts(String sourceSisCourseSiteId
}

List<String> sourceCourseEtextIsbns = sourceSisCourse.getEtextIsbns() == null
? new ArrayList<>() : List.of(sourceSisCourse.getEtextIsbns().split(","));
? new ArrayList<>() : new ArrayList<>(List.of(sourceSisCourse.getEtextIsbns().split(",")));

List<String> destinationCourseEtextIsbns = destinationSisCourse.getEtextIsbns() == null
? new ArrayList<>() : List.of(destinationSisCourse.getEtextIsbns().split(","));
? new ArrayList<>() : new ArrayList<>(List.of(destinationSisCourse.getEtextIsbns().split(",")));

if (sourceCourseEtextIsbns.isEmpty() && destinationCourseEtextIsbns.isEmpty()) {
return true;
}

boolean containsAll = true;

for (String sourceCourseEtextIsbn : sourceCourseEtextIsbns) {
containsAll = containsAll && destinationCourseEtextIsbns.contains(sourceCourseEtextIsbn);
}

if (containsAll) {
for (String destinationCourseEtextIsbn : destinationCourseEtextIsbns) {
containsAll = containsAll && sourceCourseEtextIsbns.contains(destinationCourseEtextIsbn);
}
}
Collections.sort(sourceCourseEtextIsbns);
Collections.sort(destinationCourseEtextIsbns);

return containsAll;
return sourceCourseEtextIsbns.equals(destinationCourseEtextIsbns);
}

@Data
Expand Down

0 comments on commit cb4bf83

Please sign in to comment.