mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-06 12:23:55 +00:00
request bulk leaderboard score correction update when dialog is confirmed
This commit is contained in:
1 parent
1939fd6f9d
commit
4279f9583e
4 files changed
+41
-10
No files matched your search
+2
@@ -331,4 +331,6 @@ public interface StringMessages extends Messages {
|
||||
String importOfficialResults();
|
||||
String selectAll();
|
||||
String apply();
|
||||
String successfullyUpdatedScores();
|
||||
String errorUpdatingScoresForLeaderboard(String leaderboardName, String message);
|
||||
}
|
||||
+3
-1
@@ -327,4 +327,6 @@ errorObtainingScoreCorrections=Error obtaining score corrections from provider {
|
||||
assignRaceNumbersToRaceColumns=Assign race numbers of official results to leaderboard race columns
|
||||
importOfficialResults=Import official results...
|
||||
selectAll=Select all
|
||||
apply=Apply
|
||||
apply=Apply
|
||||
successfullyUpdatedScores=Successfully updated scores
|
||||
errorUpdatingScoresForLeaderboard=Error updating scores for leaderboard {0}: {1}
|
||||
+3
-1
@@ -328,4 +328,6 @@ errorObtainingScoreCorrections=Fehler beim laden der offiziellen Ergebnisse von
|
||||
assignRaceNumbersToRaceColumns=Renn-Nummern den Ergebnisspalten zuordnen
|
||||
importOfficialResults=Offizielle Ergebnisse importieren...
|
||||
selectAll=Alle auswählen
|
||||
apply=Übernehmen
|
||||
apply=Übernehmen
|
||||
successfullyUpdatedScores=Ergebnisse erfolgreich aktualisiert
|
||||
errorUpdatingScoresForLeaderboard=Fehler beim Aktualisieren der Ergebnisse für {0}: {1}
|
||||
+33
-8
@@ -12,6 +12,7 @@ import com.google.gwt.event.logical.shared.ValueChangeEvent;
|
||||
import com.google.gwt.event.logical.shared.ValueChangeHandler;
|
||||
import com.google.gwt.regexp.shared.MatchResult;
|
||||
import com.google.gwt.regexp.shared.RegExp;
|
||||
import com.google.gwt.user.client.Window;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.CheckBox;
|
||||
import com.google.gwt.user.client.ui.Grid;
|
||||
@@ -51,7 +52,8 @@ public class MatchAndApplyScoreCorrectionsDialog extends DataEntryDialog<BulkSco
|
||||
public MatchAndApplyScoreCorrectionsDialog(LeaderboardDTO leaderboard, StringMessages stringMessages,
|
||||
SailingServiceAsync sailingService, ErrorReporter errorReporter, RegattaScoreCorrectionDTO result) {
|
||||
super(stringMessages.assignRaceNumbersToRaceColumns(), stringMessages.assignRaceNumbersToRaceColumns(),
|
||||
stringMessages.ok(), stringMessages.cancel(), new Validator(), new Callback());
|
||||
stringMessages.ok(), stringMessages.cancel(), new Validator(), new Callback(sailingService,
|
||||
stringMessages, errorReporter));
|
||||
this.regattaScoreCorrection = result;
|
||||
this.leaderboard = leaderboard;
|
||||
this.allOfficialRaceIDs = new HashSet<String>();
|
||||
@@ -204,7 +206,7 @@ public class MatchAndApplyScoreCorrectionsDialog extends DataEntryDialog<BulkSco
|
||||
|
||||
@Override
|
||||
protected BulkScoreCorrectionDTO getResult() {
|
||||
BulkScoreCorrectionDTO result = new BulkScoreCorrectionDTO();
|
||||
BulkScoreCorrectionDTO result = new BulkScoreCorrectionDTO(leaderboard.name);
|
||||
for (CompetitorDTO competitor : leaderboard.competitors) {
|
||||
for (RaceColumnDTO raceColumn : leaderboard.getRaceList()) {
|
||||
Pair<CompetitorDTO, RaceColumnDTO> key = new Pair<CompetitorDTO, RaceColumnDTO>(competitor, raceColumn);
|
||||
@@ -217,7 +219,8 @@ public class MatchAndApplyScoreCorrectionsDialog extends DataEntryDialog<BulkSco
|
||||
regattaScoreCorrection.getScoreCorrectionsByRaceNameOrNumber()
|
||||
.get(raceNameOrNumber).get(officialSailID);
|
||||
result.addMaxPointsReasonUpdate(competitor, raceColumn, officialCorrectionEntry.getMaxPointsReason());
|
||||
result.addScoreUpdate(competitor, raceColumn, officialCorrectionEntry.getScore().intValue());
|
||||
result.addScoreUpdate(competitor, raceColumn,
|
||||
(int) Math.round(officialCorrectionEntry.getScore().doubleValue()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -301,14 +304,36 @@ public class MatchAndApplyScoreCorrectionsDialog extends DataEntryDialog<BulkSco
|
||||
}
|
||||
|
||||
private static class Callback implements AsyncCallback<BulkScoreCorrectionDTO> {
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
// TODO Auto-generated method stub
|
||||
private final SailingServiceAsync sailingService;
|
||||
private final StringMessages stringMessages;
|
||||
private final ErrorReporter errorReporter;
|
||||
|
||||
public Callback(SailingServiceAsync sailingService, StringMessages stringMessages, ErrorReporter errorReporter) {
|
||||
super();
|
||||
this.sailingService = sailingService;
|
||||
this.stringMessages = stringMessages;
|
||||
this.errorReporter = errorReporter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(BulkScoreCorrectionDTO result) {
|
||||
// TODO Auto-generated method stub
|
||||
public void onFailure(Throwable caught) {
|
||||
// user has canceled the dialog
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(final BulkScoreCorrectionDTO result) {
|
||||
sailingService.updateLeaderboardScoreCorrectionsAndMaxPointsReasons(result, new AsyncCallback<Void>() {
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
errorReporter.reportError(stringMessages.errorUpdatingScoresForLeaderboard(result.getLeaderboardName(),
|
||||
caught.getMessage()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(Void result) {
|
||||
Window.setStatus(stringMessages.successfullyUpdatedScores());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user