fix statistics
This commit is contained in:
2
pom.xml
2
pom.xml
@@ -35,7 +35,7 @@
|
||||
<dependency>
|
||||
<groupId>de.infinimotion</groupId>
|
||||
<artifactId>model-backend</artifactId>
|
||||
<version>0.0.110</version>
|
||||
<version>0.0.116</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Quarkus -->
|
||||
|
||||
@@ -6,6 +6,8 @@ import jakarta.inject.Inject;
|
||||
import jakarta.ws.rs.GET;
|
||||
import jakarta.ws.rs.Path;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ApplicationScoped
|
||||
@Path("/statistics")
|
||||
public class Statistics {
|
||||
@@ -14,28 +16,21 @@ public class Statistics {
|
||||
RequestReply requester;
|
||||
|
||||
@GET
|
||||
@Path("/list")
|
||||
public StatisticsReduced list() throws Exception {
|
||||
@Path("/movies")
|
||||
public List<StatisticsFilm> listMovies() throws Exception {
|
||||
CommandListStatistics request = new CommandListStatistics();
|
||||
request.setMovies(true);
|
||||
CommandWrapper requestWrapper = request.serialize().generateIds().commit();
|
||||
CommandListStatisticsResponse response = CommandListStatisticsResponse.deserialize(requester.request(requestWrapper));
|
||||
return CommandListStatisticsResponse.deserialize(requester.request(requestWrapper)).getMovies();
|
||||
}
|
||||
|
||||
StatisticsReduced stats = new StatisticsReduced();
|
||||
stats.setMovies(response.getMovies().stream().map(movieStats -> {
|
||||
StatisticsFilmReduced reduced = new StatisticsFilmReduced();
|
||||
reduced.setMovie(movieStats.getMovie());
|
||||
reduced.setTickets(movieStats.getTickets().size());
|
||||
reduced.setEarnings(movieStats.getEarnings());
|
||||
return reduced;
|
||||
}).toList());
|
||||
stats.setShows(response.getShows().stream().map(showStats -> {
|
||||
StatisticsVorstellungReduced reduced = new StatisticsVorstellungReduced();
|
||||
reduced.setShow(showStats.getShow());
|
||||
reduced.setTickets(showStats.getTickets().size());
|
||||
reduced.setEarnings(showStats.getEarnings());
|
||||
return reduced;
|
||||
}).toList());
|
||||
return stats;
|
||||
@GET
|
||||
@Path("/shows")
|
||||
public List<StatisticsVorstellung> listShows() throws Exception {
|
||||
CommandListStatistics request = new CommandListStatistics();
|
||||
request.setShows(true);
|
||||
CommandWrapper requestWrapper = request.serialize().generateIds().commit();
|
||||
return CommandListStatisticsResponse.deserialize(requester.request(requestWrapper)).getShows();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user