diff --git a/module-server/src/main/java/de/twomartens/wahlrecht/repository/ElectionResultRepository.java b/module-server/src/main/java/de/twomartens/wahlrecht/repository/ElectionResultRepository.java index 51dd244..bdbc237 100644 --- a/module-server/src/main/java/de/twomartens/wahlrecht/repository/ElectionResultRepository.java +++ b/module-server/src/main/java/de/twomartens/wahlrecht/repository/ElectionResultRepository.java @@ -1,9 +1,7 @@ package de.twomartens.wahlrecht.repository; import de.twomartens.wahlrecht.model.db.ElectionResult; -import java.util.Optional; import org.springframework.data.mongodb.repository.MongoRepository; public interface ElectionResultRepository extends MongoRepository { - Optional findByElectionName(String name); } diff --git a/module-server/src/main/java/de/twomartens/wahlrecht/repository/VotingResultRepository.java b/module-server/src/main/java/de/twomartens/wahlrecht/repository/VotingResultRepository.java deleted file mode 100644 index 8d37ecb..0000000 --- a/module-server/src/main/java/de/twomartens/wahlrecht/repository/VotingResultRepository.java +++ /dev/null @@ -1,8 +0,0 @@ -package de.twomartens.wahlrecht.repository; - -import de.twomartens.wahlrecht.model.db.VotingResult; -import org.springframework.data.mongodb.repository.MongoRepository; - -public interface VotingResultRepository extends MongoRepository { - -} diff --git a/module-server/src/main/java/de/twomartens/wahlrecht/service/CalculationService.java b/module-server/src/main/java/de/twomartens/wahlrecht/service/CalculationService.java index 40da6e1..3caa0ad 100644 --- a/module-server/src/main/java/de/twomartens/wahlrecht/service/CalculationService.java +++ b/module-server/src/main/java/de/twomartens/wahlrecht/service/CalculationService.java @@ -37,11 +37,10 @@ public class CalculationService { private final NominationService nominationService; private final ElectionService electionService; private final LinkedList electionNumberHistory = new LinkedList<>(); - private StopWatch stopWatch; public ElectedCandidates determineElectedCandidates(@NonNull ElectionResult electionResult) { log.info("Calculate election result for election {}", electionResult.electionName()); - stopWatch = new StopWatch(); + StopWatch stopWatch = new StopWatch(); stopWatch.start("determineElectedCandidates"); Election election = electionService.getElectionInternal(electionResult.electionName()); SeatResult seatResult = calculateOverallSeatDistribution(election, diff --git a/module-server/src/main/java/de/twomartens/wahlrecht/service/ConstituencyService.java b/module-server/src/main/java/de/twomartens/wahlrecht/service/ConstituencyService.java index daae51a..6a92d13 100644 --- a/module-server/src/main/java/de/twomartens/wahlrecht/service/ConstituencyService.java +++ b/module-server/src/main/java/de/twomartens/wahlrecht/service/ConstituencyService.java @@ -1,15 +1,12 @@ package de.twomartens.wahlrecht.service; -import de.twomartens.wahlrecht.mapper.v1.ConstituencyMapper; import de.twomartens.wahlrecht.model.db.Constituency; import de.twomartens.wahlrecht.model.internal.ConstituencyId; import de.twomartens.wahlrecht.repository.ConstituencyRepository; -import java.util.Collection; import java.util.Map; import java.util.function.Function; import java.util.stream.Collectors; import lombok.RequiredArgsConstructor; -import org.mapstruct.factory.Mappers; import org.springframework.lang.NonNull; import org.springframework.stereotype.Service; @@ -18,23 +15,9 @@ import org.springframework.stereotype.Service; public class ConstituencyService { private final ConstituencyRepository repository; - private final ConstituencyMapper mapper = Mappers.getMapper(ConstituencyMapper.class); private Map constituencies; - public Collection getConstituencies() { - return repository.findAll(); - } - - public Constituency getConstituency(ConstituencyId constituencyId) { - return constituencies.get(constituencyId); - } - - public de.twomartens.wahlrecht.model.internal.Constituency getConstituencyInternal( - ConstituencyId constituencyId) { - return mapper.mapToInternal(getConstituency(constituencyId)); - } - public Constituency storeConstituency(@NonNull Constituency constituency) { if (constituencies == null) { fetchConstituencies(); diff --git a/module-server/src/main/java/de/twomartens/wahlrecht/service/PartyService.java b/module-server/src/main/java/de/twomartens/wahlrecht/service/PartyService.java index db0628f..3035cd8 100644 --- a/module-server/src/main/java/de/twomartens/wahlrecht/service/PartyService.java +++ b/module-server/src/main/java/de/twomartens/wahlrecht/service/PartyService.java @@ -32,20 +32,6 @@ public class PartyService { return parties; } - public PartyInElection getPartyByElectionNameAndAbbreviation(String electionName, - String abbreviation) { - if (parties == null) { - fetchParties(); - } - PartyId partyId = new PartyId(electionName, abbreviation); - PartyInElection party = parties.get(partyId); - if (party == null) { - throw new ResponseStatusException(HttpStatus.NOT_FOUND, - "no party found for %s and %s".formatted(electionName, abbreviation)); - } - return party; - } - public boolean storeParty(PartyInElection partyInElection) { if (parties == null) { fetchParties();