mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-09-21 21:25:38 +00:00
bug6016: added timepoint-ms and lastScoringUpdate-ms fields to /leaderboardgroups/{name|id} response
This commit is contained in:
+6
-3
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user