bug6016: added timepoint-ms and lastScoringUpdate-ms fields to /leaderboardgroups/{name|id} response

This commit is contained in:
Axel Uhl
2024-06-11 10:40:16 +02:00
parent e5835482c4
commit 4576450303
4 changed files with 16 additions and 3 deletions
@@ -139,15 +139,16 @@ public class LeaderboardGroupsResource extends AbstractSailingServerResource {
.type(MediaType.TEXT_PLAIN).build();
} else {
if (getSecurityService().hasCurrentUserReadPermission(leaderboardGroup)) {
TimePoint timePoint = MillisecondsTimePoint.now();
JSONObject jsonLeaderboardGroup = new JSONObject();
final TimePoint timePoint = MillisecondsTimePoint.now();
final JSONObject jsonLeaderboardGroup = new JSONObject();
jsonLeaderboardGroup.put(LeaderboardGroupConstants.NAME, leaderboardGroup.getName());
jsonLeaderboardGroup.put(LeaderboardGroupConstants.ID, leaderboardGroup.getId().toString());
jsonLeaderboardGroup.put(LeaderboardGroupConstants.DISPLAYNAME, leaderboardGroup.getDisplayName());
jsonLeaderboardGroup.put(LeaderboardGroupConstants.DESCRIPTION, leaderboardGroup.getDescription());
jsonLeaderboardGroup.put(LeaderboardGroupConstants.TIMEPOINT, timePoint.toString());
jsonLeaderboardGroup.put(LeaderboardGroupConstants.TIMEPOINT_MILLIS, timePoint.asMillis());
final Set<Event> eventsReferencingLeaderboardGroup = new HashSet<>();
JSONArray idsOfEventsReferencingLeaderboardGroup = new JSONArray();
final JSONArray idsOfEventsReferencingLeaderboardGroup = new JSONArray();
for (final Event event : getService().getAllEvents()) {
if (Util.contains(event.getLeaderboardGroups(), leaderboardGroup)) {
eventsReferencingLeaderboardGroup.add(event);
@@ -173,6 +174,8 @@ public class LeaderboardGroupsResource extends AbstractSailingServerResource {
TimePoint lastUpdateTimepoint = scoreCorrection.getTimePointOfLastCorrectionsValidity();
jsonLeaderboard.put(LeaderboardNameConstants.LASTSCORINGUPDATE,
lastUpdateTimepoint != null ? lastUpdateTimepoint.asDate().toString() : null);
jsonLeaderboard.put(LeaderboardNameConstants.LASTSCORINGUPDATE_MILLIS,
lastUpdateTimepoint != null ? lastUpdateTimepoint.asMillis() : null);
} else {
jsonLeaderboard.put(LeaderboardNameConstants.SCORINGCOMMENT, null);
jsonLeaderboard.put(LeaderboardNameConstants.LASTSCORINGUPDATE, null);