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