| 1 | package edu.ucsb.cs156.happiercows.jobs; | |
| 2 | ||
| 3 | import edu.ucsb.cs156.happiercows.entities.Game; | |
| 4 | import edu.ucsb.cs156.happiercows.entities.Report; | |
| 5 | import edu.ucsb.cs156.happiercows.repositories.GameRepository; | |
| 6 | import edu.ucsb.cs156.jobs.services.JobContext; | |
| 7 | import edu.ucsb.cs156.jobs.services.JobContextConsumer; | |
| 8 | import edu.ucsb.cs156.happiercows.services.ReportService; | |
| 9 | import lombok.AllArgsConstructor; | |
| 10 | import lombok.Getter; | |
| 11 | ||
| 12 | @AllArgsConstructor | |
| 13 | public class InstructorReportJob implements JobContextConsumer { | |
| 14 | ||
| 15 | @Getter | |
| 16 | private ReportService reportService; | |
| 17 | ||
| 18 | @Getter | |
| 19 | private GameRepository gameRepository; | |
| 20 | ||
| 21 | @Override | |
| 22 | public void accept(JobContext ctx) throws Exception { | |
| 23 |
1
1. accept : removed call to edu/ucsb/cs156/jobs/services/JobContext::log → KILLED |
ctx.log("Starting instructor report..."); |
| 24 | Iterable<Game> allGame = gameRepository.findAll(); | |
| 25 | ||
| 26 | for (Game game : allGame) { | |
| 27 |
1
1. accept : negated conditional → KILLED |
if (!GameGate.shouldProcess(game, gameRepository, ctx)) { |
| 28 | continue; | |
| 29 | } | |
| 30 |
1
1. accept : removed call to edu/ucsb/cs156/jobs/services/JobContext::log → KILLED |
ctx.log(String.format("Starting Game id=%d (%s)...", game.getId(), game.getName())); |
| 31 | Report report = reportService.createReport(game.getId()); | |
| 32 |
1
1. accept : removed call to edu/ucsb/cs156/jobs/services/JobContext::log → KILLED |
ctx.log(String.format("Report %d for game id=%d (%s) finished.", report.getId(), game.getId(), |
| 33 | game.getName())); | |
| 34 | } | |
| 35 |
1
1. accept : removed call to edu/ucsb/cs156/jobs/services/JobContext::log → KILLED |
ctx.log("Instructor report done!"); |
| 36 | } | |
| 37 | } | |
Mutations | ||
| 23 |
1.1 |
|
| 27 |
1.1 |
|
| 30 |
1.1 |
|
| 32 |
1.1 |
|
| 35 |
1.1 |