diff --git a/src/main/java/com/iteratec/teamdojo/service/impl/custom/CustomTeamScoreServiceImpl.java b/src/main/java/com/iteratec/teamdojo/service/impl/custom/CustomTeamScoreServiceImpl.java index cd049e3e..d5d456c8 100644 --- a/src/main/java/com/iteratec/teamdojo/service/impl/custom/CustomTeamScoreServiceImpl.java +++ b/src/main/java/com/iteratec/teamdojo/service/impl/custom/CustomTeamScoreServiceImpl.java @@ -4,6 +4,8 @@ */ package com.iteratec.teamdojo.service.impl.custom; +import com.iteratec.teamdojo.domain.Skill; +import com.iteratec.teamdojo.repository.SkillRepository; import com.iteratec.teamdojo.service.TeamSkillQueryService; import com.iteratec.teamdojo.service.criteria.TeamSkillCriteria; import com.iteratec.teamdojo.service.custom.CustomTeamScoreService; @@ -21,14 +23,17 @@ public class CustomTeamScoreServiceImpl implements CustomTeamScoreService { private final TeamSkillQueryService teamSkillQueryService; + private final SkillRepository skillRepository; - public CustomTeamScoreServiceImpl(TeamSkillQueryService teamSkillQueryService) { + public CustomTeamScoreServiceImpl(TeamSkillQueryService teamSkillQueryService, SkillRepository skillRepository) { this.teamSkillQueryService = teamSkillQueryService; + this.skillRepository = skillRepository; } @Override public TeamScoreDTO calculateTeamScore(@NonNull final TeamDTO t) { final var teamSkills = this.retrieveTeamSkills(t.getId()); + final var allSkills = this.retrieveAllSkills(); final var achieved = calculateAchieved(); final var required = calculateRequired(); @@ -65,4 +70,8 @@ private Collection retrieveTeamSkills(final long teamId) { teamSkillCriteria.setTeamId(longFilter); return this.teamSkillQueryService.findByCriteria(teamSkillCriteria); } + + private Collection retrieveAllSkills() { + return this.skillRepository.findAll(); + } } diff --git a/src/test/java/com/iteratec/teamdojo/service/impl/custom/CustomTeamScoreServiceImplTest.java b/src/test/java/com/iteratec/teamdojo/service/impl/custom/CustomTeamScoreServiceImplTest.java index af1e07f3..29d3175a 100644 --- a/src/test/java/com/iteratec/teamdojo/service/impl/custom/CustomTeamScoreServiceImplTest.java +++ b/src/test/java/com/iteratec/teamdojo/service/impl/custom/CustomTeamScoreServiceImplTest.java @@ -3,6 +3,7 @@ import static org.assertj.core.api.AssertionsForInterfaceTypes.assertThat; import static org.junit.jupiter.api.Assertions.assertAll; +import com.iteratec.teamdojo.repository.SkillRepository; import com.iteratec.teamdojo.repository.TeamSkillRepository; import com.iteratec.teamdojo.service.TeamSkillQueryService; import org.junit.jupiter.api.Test; @@ -16,7 +17,10 @@ class CustomTeamScoreServiceImplTest { @Mock private TeamSkillQueryService teamSkillQueryService; - private final CustomTeamScoreServiceImpl sut = new CustomTeamScoreServiceImpl(teamSkillQueryService); + @Mock + private SkillRepository skillRepository; + + private final CustomTeamScoreServiceImpl sut = new CustomTeamScoreServiceImpl(teamSkillQueryService, skillRepository); @Test void calculateProgress() {}