From 1dd3400380650dbc72566452191fc59b4caad077 Mon Sep 17 00:00:00 2001 From: T3C42 Date: Sat, 30 Nov 2024 17:59:16 +0100 Subject: [PATCH] Change Backlog Submission Date to Latest Result Date (#81) --- .../extensions/guis/BacklogPanel.java | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/main/java/edu/kit/kastel/sdq/intelligrade/extensions/guis/BacklogPanel.java b/src/main/java/edu/kit/kastel/sdq/intelligrade/extensions/guis/BacklogPanel.java index d20e2a1..5f5ce7b 100644 --- a/src/main/java/edu/kit/kastel/sdq/intelligrade/extensions/guis/BacklogPanel.java +++ b/src/main/java/edu/kit/kastel/sdq/intelligrade/extensions/guis/BacklogPanel.java @@ -2,8 +2,8 @@ package edu.kit.kastel.sdq.intelligrade.extensions.guis; import java.awt.event.ActionEvent; +import java.time.ZoneId; import java.time.format.DateTimeFormatter; -import java.time.format.FormatStyle; import java.util.ArrayList; import java.util.Comparator; import java.util.List; @@ -119,7 +119,7 @@ private void updateBacklog() { // Participant backlogList.add(new JBLabel(submission.getParticipantIdentifier())); - addSubmissionDateLabel(submission); + addResultDateLabel(submission); // Correction Round backlogList.add(new JBLabel("Round " + (submission.getCorrectionRound() + 1))); addScoreItem(submission); @@ -131,11 +131,18 @@ private void updateBacklog() { this.updateUI(); } - private void addSubmissionDateLabel(ProgrammingSubmission submission) { - String dateText = submission - .getSubmissionDate() - .format(DateTimeFormatter.ofLocalizedDateTime(FormatStyle.SHORT, FormatStyle.SHORT)); - backlogList.add(new JBLabel(dateText), "alignx right"); + private void addResultDateLabel(ProgrammingSubmission submission) { + var latestResult = submission.getLatestResult(); + String resultText = ""; + if (submission.isSubmitted()) { + resultText = latestResult + .map(resultDTO -> resultDTO + .completionDate() + .withZoneSameInstant(ZoneId.systemDefault()) + .format(DateTimeFormatter.ofPattern("dd.MM.yyyy HH:mm"))) + .orElse("???"); + } + backlogList.add(new JBLabel(resultText), "alignx right"); } private void addScoreItem(ProgrammingSubmission submission) {