Changeset 4cec0a3 for src/main/java/it/finki/tinki/service/impl
- Timestamp:
- 01/08/21 02:08:22 (4 years ago)
- Branches:
- master
- Children:
- b24fe9b
- Parents:
- a8e8545
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/java/it/finki/tinki/service/impl/MatchmakerServiceImpl.java
ra8e8545 r4cec0a3 42 42 @Override 43 43 public List<Internship> getMatchingInternshipsForUser(User user) { 44 List<Match> matches = this.matchRepository.getAllByEmbeddedMatchIdUserAndTypeOrderByCoefficientDesc(user.getId(), WorkType.INTERNSHIP); 45 // List<Match> matches = this.matchRepository.getAllByUserIdAndTypeOrderByCoefficientDesc(user.getId(), WorkType.INTERNSHIP); 44 List<Match> matches = this.matchRepository.findAllByEmbeddedMatchIdUserAndTypeOrderByCoefficientDesc(user, WorkType.INTERNSHIP); 46 45 47 46 List<Internship> internships = new ArrayList<>(); 48 matches.forEach(match -> { 49 internships.add((Internship) match.getEmbeddedMatchId().getWork()); 50 // internships.add(this.internshipRepository.findById(match.getWorkId()).get()); 51 }); 47 if(matches.size()!=0){ 48 matches.forEach(match -> { 49 internships.add((Internship) match.getEmbeddedMatchId().getWork()); 50 }); 51 } 52 52 53 53 return internships; … … 56 56 @Override 57 57 public List<Job> getMatchingJobsForUser(User user) { 58 List<Match> matches = this.matchRepository.getAllByEmbeddedMatchIdUserAndTypeOrderByCoefficientDesc(user.getId(), WorkType.INTERNSHIP); 59 // List<Match> matches = this.matchRepository.getAllByUserIdAndTypeOrderByCoefficientDesc(user.getId(), WorkType.JOB); 58 List<Match> matches = this.matchRepository.findAllByEmbeddedMatchIdUserAndTypeOrderByCoefficientDesc(user, WorkType.JOB); 60 59 61 60 List<Job> jobs = new ArrayList<>(); 62 matches.forEach(match -> { 63 jobs.add((Job) match.getEmbeddedMatchId().getWork()); 64 // jobs.add(this.jobRepository.findById(match.getWorkId()).get()); 65 }); 61 if(matches.size()!=0) { 62 matches.forEach(match -> { 63 jobs.add((Job) match.getEmbeddedMatchId().getWork()); 64 }); 65 } 66 66 67 67 return jobs; … … 70 70 @Override 71 71 public List<Project> getMatchingProjectsForUser(User user) { 72 List<Match> matches = this.matchRepository.getAllByEmbeddedMatchIdUserAndTypeOrderByCoefficientDesc(user.getId(), WorkType.INTERNSHIP); 73 // List<Match> matches = this.matchRepository.getAllByUserIdAndTypeOrderByCoefficientDesc(user.getId(), WorkType.PROJECT); 72 List<Match> matches = this.matchRepository.findAllByEmbeddedMatchIdUserAndTypeOrderByCoefficientDesc(user, WorkType.PROJECT); 74 73 75 74 List<Project> projects = new ArrayList<>(); 76 matches.forEach(match -> { 77 projects.add((Project) match.getEmbeddedMatchId().getWork()); 78 // projects.add(this.projectRepository.findById(match.getWorkId()).get()); 79 }); 75 if(matches.size()!=0) { 76 matches.forEach(match -> { 77 projects.add((Project) match.getEmbeddedMatchId().getWork()); 78 }); 79 } 80 80 81 81 return projects; … … 92 92 EmbeddedMatchId embeddedMatchId = new EmbeddedMatchId(job, user); 93 93 Match m = new Match(embeddedMatchId, coef, WorkType.JOB); 94 // Match m = new Match(job.getId(), user.getId(), coef, WorkType.JOB);95 94 this.matchRepository.save(m); 96 95 } … … 107 106 EmbeddedMatchId embeddedMatchId = new EmbeddedMatchId(project, user); 108 107 Match m = new Match(embeddedMatchId, coef, WorkType.PROJECT); 109 // Match m = new Match(project.getId(), user.getId(), coef, WorkType.JOB);110 108 this.matchRepository.save(m); 111 109 } … … 122 120 EmbeddedMatchId embeddedMatchId = new EmbeddedMatchId(internship, user); 123 121 Match m = new Match(embeddedMatchId, coef, WorkType.PROJECT); 124 // Match m = new Match(internship.getId(), user.getId(), coef, WorkType.JOB);125 122 this.matchRepository.save(m); 126 123 }
Note:
See TracChangeset
for help on using the changeset viewer.