don't display NONE in max points reason drop-down in editable leaderboard, fixing bug 618

This commit is contained in:
Axel Uhl committed 2012-05-11 23:50:32 +02:00
1 parent d8d5293b71
commit 19d54662e1
5 files changed
+10 -8

No files matched your search

@@ -279,8 +279,8 @@ public class LeaderboardImpl implements Named, Leaderboard {
}
boolean discarded = discardedRacesForCompetitor.contains(raceColumn);
Entry entry = new EntryImpl(trackedPoints, correctedResults.getCorrectedScore(),
correctedResults.isCorrected(),
discarded ? 0 : correctedResults.getCorrectedScore() * (raceColumn.isMedalRace() ? 2 : 1), correctedResults.getMaxPointsReason(), discarded);
correctedResults.isCorrected(), discarded ? 0 : correctedResults.getCorrectedScore()
* (raceColumn.isMedalRace() ? 2 : 1), correctedResults.getMaxPointsReason(), discarded);
result.put(new Pair<Competitor, RaceInLeaderboard>(competitor, raceColumn), entry);
}
}
@@ -46,6 +46,7 @@ import com.google.gwt.view.client.SelectionChangeEvent.Handler;
import com.google.gwt.view.client.SelectionModel;
import com.sap.sailing.domain.common.DetailType;
import com.sap.sailing.domain.common.EventAndRaceIdentifier;
import com.sap.sailing.domain.common.MaxPointsReason;
import com.sap.sailing.domain.common.RaceIdentifier;
import com.sap.sailing.gwt.ui.actions.AsyncActionsExecutor;
import com.sap.sailing.gwt.ui.actions.GetLeaderboardByNameAction;
@@ -466,7 +467,7 @@ public class LeaderboardPanel extends FormPanel implements TimeListener, PlaySta
if (entry.discarded) {
html.appendHtmlConstant("<del>");
}
html.appendEscaped(entry.reasonForMaxPoints);
html.appendEscaped(entry.reasonForMaxPoints == MaxPointsReason.NONE ? "" : entry.reasonForMaxPoints.name());
if (entry.discarded) {
html.appendHtmlConstant("</del>");
}
@@ -222,7 +222,7 @@ public class EditableLeaderboardPanel extends LeaderboardPanel {
@Override
public void onSuccess(Pair<Integer, Integer> newNetAndTotalPoints) {
row.fieldsByRaceName.get(raceName).reasonForMaxPoints = value == null
|| value.length() == 0 ? null : value.trim();
|| value.length() == 0 ? null : MaxPointsReason.valueOf(value.trim());
row.fieldsByRaceName.get(raceName).netPoints = newNetAndTotalPoints.getA();
row.fieldsByRaceName.get(raceName).totalPoints = newNetAndTotalPoints.getB();
getCell().setViewData(row, null); // ensure that getValue() is called again
@@ -236,11 +236,11 @@ public class EditableLeaderboardPanel extends LeaderboardPanel {
@Override
public String getValue(LeaderboardRowDTO object) {
LeaderboardEntryDTO leaderboardEntryDTO = object.fieldsByRaceName.get(raceName);
String reasonForMaxPoints = null;
MaxPointsReason reasonForMaxPoints = null;
if (leaderboardEntryDTO != null) {
reasonForMaxPoints = leaderboardEntryDTO.reasonForMaxPoints;
}
return reasonForMaxPoints == null ? "" : reasonForMaxPoints;
return reasonForMaxPoints == null || reasonForMaxPoints == MaxPointsReason.NONE ? "" : reasonForMaxPoints.name();
}
}
@@ -336,7 +336,7 @@ public class SailingServiceImpl extends RemoteServiceServlet implements SailingS
entryDTO.netPoints = entry.getNetPoints();
entryDTO.netPointsCorrected = entry.isNetPointsCorrected();
entryDTO.totalPoints = entry.getTotalPoints();
entryDTO.reasonForMaxPoints = entry.getMaxPointsReason().name();
entryDTO.reasonForMaxPoints = entry.getMaxPointsReason();
entryDTO.discarded = entry.isDiscarded();
if (addLegDetails && trackedRace != null) {
entryDTO.legDetails = new ArrayList<LegEntryDTO>();
@@ -3,6 +3,7 @@ package com.sap.sailing.gwt.ui.shared;
import java.util.List;
import com.google.gwt.user.client.rpc.IsSerializable;
import com.sap.sailing.domain.common.MaxPointsReason;
/**
* Holds a single competitor's scoring details for a single race. It may optionally contain
@@ -16,7 +17,7 @@ public class LeaderboardEntryDTO implements IsSerializable {
/**
* Either <code>null</code> in case no max points, or one of "DNS", "DNF", "OCS", "DND", "RAF", "BFD", "DNC", or "DSQ"
*/
public String reasonForMaxPoints;
public MaxPointsReason reasonForMaxPoints;
public int netPoints;