diff --git a/judgels-backends/judgels-server-api/src/main/java/judgels/uriel/api/contest/rating/ContestRatingChanges.java b/judgels-backends/judgels-server-api/src/main/java/judgels/uriel/api/contest/rating/ContestRatingChanges.java index 2ea8e9c4e..fe285bcde 100644 --- a/judgels-backends/judgels-server-api/src/main/java/judgels/uriel/api/contest/rating/ContestRatingChanges.java +++ b/judgels-backends/judgels-server-api/src/main/java/judgels/uriel/api/contest/rating/ContestRatingChanges.java @@ -7,7 +7,7 @@ import org.immutables.value.Value; @Value.Immutable -@JsonDeserialize(as = ImmutableContestRating.class) +@JsonDeserialize(as = ImmutableContestRatingChanges.class) public interface ContestRatingChanges { Map getRatingsMap(); Map getProfilesMap(); diff --git a/judgels-backends/judgels-server-app/src/integTest/java/judgels/uriel/api/ContestRatingApiIntegrationTests.java b/judgels-backends/judgels-server-app/src/integTest/java/judgels/uriel/api/ContestRatingApiIntegrationTests.java new file mode 100644 index 000000000..3c366983d --- /dev/null +++ b/judgels-backends/judgels-server-app/src/integTest/java/judgels/uriel/api/ContestRatingApiIntegrationTests.java @@ -0,0 +1,16 @@ +package judgels.uriel.api; + +import static org.assertj.core.api.Assertions.assertThat; + +import judgels.uriel.ContestRatingClient; +import org.junit.jupiter.api.Test; + +class ContestRatingApiIntegrationTests extends BaseUrielApiIntegrationTests { + private final ContestRatingClient ratingClient = createClient(ContestRatingClient.class); + + @Test + void get_pending_ratings() { + assertThat(ratingClient.getContestsPendingRating(superadminToken).getData()) + .isEmpty(); + } +} diff --git a/judgels-backends/judgels-server-app/src/main/java/judgels/uriel/contest/rating/ContestRatingResource.java b/judgels-backends/judgels-server-app/src/main/java/judgels/uriel/contest/rating/ContestRatingResource.java index 005f8b299..3f9b6943e 100644 --- a/judgels-backends/judgels-server-app/src/main/java/judgels/uriel/contest/rating/ContestRatingResource.java +++ b/judgels-backends/judgels-server-app/src/main/java/judgels/uriel/contest/rating/ContestRatingResource.java @@ -62,7 +62,7 @@ public ContestsPendingRatingResponse getContestsPendingRating(@HeaderParam(AUTHO checkAllowed(contestRoleChecker.canAdminister(actorJid)); Optional latestEvent = jophielClient.getLatestRatingEvent(); - Instant latestTime = latestEvent.isPresent() ? latestEvent.get().getTime() : Instant.MIN; + Instant latestTime = latestEvent.isPresent() ? latestEvent.get().getTime() : Instant.EPOCH; List contests = contestStore.getPublicContestsAfter(latestTime); Map ratingChangesMap = contests.stream() diff --git a/judgels-backends/judgels-server-feign/src/main/java/judgels/uriel/ContestRatingClient.java b/judgels-backends/judgels-server-feign/src/main/java/judgels/uriel/ContestRatingClient.java new file mode 100644 index 000000000..8eb9e0aa6 --- /dev/null +++ b/judgels-backends/judgels-server-feign/src/main/java/judgels/uriel/ContestRatingClient.java @@ -0,0 +1,12 @@ +package judgels.uriel; + +import feign.Headers; +import feign.Param; +import feign.RequestLine; +import judgels.uriel.api.contest.rating.ContestsPendingRatingResponse; + +public interface ContestRatingClient { + @RequestLine("GET /api/v2/contest-rating/pending") + @Headers("Authorization: Bearer {token}") + ContestsPendingRatingResponse getContestsPendingRating(@Param("token") String token); +}