fixed an issue with the getting of curriculums
This commit is contained in:
parent
6e6bd285af
commit
4cf2ac1aa8
@ -3,6 +3,7 @@ package ovh.herisson.Clyde.Services;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import ovh.herisson.Clyde.Repositories.CourseRepository;
|
import ovh.herisson.Clyde.Repositories.CourseRepository;
|
||||||
import ovh.herisson.Clyde.Repositories.CurriculumCourseRepository;
|
import ovh.herisson.Clyde.Repositories.CurriculumCourseRepository;
|
||||||
|
import ovh.herisson.Clyde.Repositories.CurriculumRepository;
|
||||||
import ovh.herisson.Clyde.Tables.*;
|
import ovh.herisson.Clyde.Tables.*;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -16,9 +17,12 @@ public class CurriculumCourseService {
|
|||||||
|
|
||||||
private final CourseRepository courseRepo;
|
private final CourseRepository courseRepo;
|
||||||
|
|
||||||
public CurriculumCourseService(CurriculumCourseRepository curriculumCourseRepository, CourseRepository courseRepo) {
|
private final CurriculumRepository curriculumRepo;
|
||||||
|
|
||||||
|
public CurriculumCourseService(CurriculumCourseRepository curriculumCourseRepository, CourseRepository courseRepo, CurriculumRepository curriculumRepo) {
|
||||||
this.curriculumCourseRepo = curriculumCourseRepository;
|
this.curriculumCourseRepo = curriculumCourseRepository;
|
||||||
this.courseRepo = courseRepo;
|
this.courseRepo = courseRepo;
|
||||||
|
this.curriculumRepo = curriculumRepo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void save(CurriculumCourse curriculumCourse){
|
public void save(CurriculumCourse curriculumCourse){
|
||||||
@ -51,9 +55,11 @@ public class CurriculumCourseService {
|
|||||||
|
|
||||||
ArrayList<Map<String,Object>> toReturn = new ArrayList<>();
|
ArrayList<Map<String,Object>> toReturn = new ArrayList<>();
|
||||||
|
|
||||||
for (Curriculum curriculum : curriculumCourseRepo.findDistinctCurriculums()){
|
for (Curriculum curriculum : curriculumRepo.findAll()){
|
||||||
toReturn.add(getDepthCurriculum(curriculum));
|
toReturn.add(getDepthCurriculum(curriculum));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return toReturn;
|
return toReturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,6 +76,7 @@ public class CurriculumCourseService {
|
|||||||
|
|
||||||
ArrayList<Course> toAdd = new ArrayList<>();
|
ArrayList<Course> toAdd = new ArrayList<>();
|
||||||
for (Long courseId : coursesIds){
|
for (Long courseId : coursesIds){
|
||||||
|
|
||||||
Course course = courseRepo.findById((long) courseId);
|
Course course = courseRepo.findById((long) courseId);
|
||||||
if (course == null)
|
if (course == null)
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user