mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-11-14 06:18:12 +00:00
bug 3483 stringMessages and formatter
This commit is contained in:
1 parent
679c4d3967
commit
938d322865
9 files changed
+184
-193
No files matched your search
+9
-8
@@ -15,17 +15,18 @@ public class AbstractPairingListParameterValidator implements Validator<PairingL
|
||||
@Override
|
||||
public String getErrorMessage(PairingListTemplateDTO valueToValidate) {
|
||||
String errorMessage = null;
|
||||
|
||||
|
||||
if (valueToValidate.getCompetitorCount() < valueToValidate.getGroupCount()) {
|
||||
errorMessage = "Invalid competitor count";
|
||||
errorMessage = stringMessages.invalidCompetitorCount();
|
||||
} else if (valueToValidate.getFlightMultiplier() < 1) {
|
||||
errorMessage = "Invalid flight multiplier";
|
||||
} else if(valueToValidate.getFlightCount()%valueToValidate.getFlightMultiplier()!=0 &&valueToValidate.getFlightMultiplier()>0){
|
||||
errorMessage= "Flightcount has to be a multiple of Flightmultiplier!";
|
||||
} else if(Util.size(valueToValidate.getSelectedFlightNames())<1) {
|
||||
errorMessage= "Invalid series selection";
|
||||
errorMessage = stringMessages.invalidFlightMultiplier();
|
||||
} else if (valueToValidate.getFlightCount() % valueToValidate.getFlightMultiplier() != 0
|
||||
&& valueToValidate.getFlightMultiplier() > 0) {
|
||||
errorMessage = stringMessages.flightsMustBeAMultipleOfMultiplier();
|
||||
} else if (Util.size(valueToValidate.getSelectedFlightNames()) < 1) {
|
||||
errorMessage = stringMessages.invalidSeriesSelection();
|
||||
}
|
||||
|
||||
|
||||
return errorMessage;
|
||||
}
|
||||
|
||||
|
||||
+34
-43
@@ -28,10 +28,7 @@ public class PairingListCreationDialog extends DataEntryDialog<PairingListTempla
|
||||
private final PairingListTemplateDTO template;
|
||||
private final SailingServiceAsync sailingService;
|
||||
private final StrippedLeaderboardDTO leaderboardDTO;
|
||||
/*
|
||||
* private final FlowPanel panelForAdditionalWidget; private final DockPanel buttonPanel; private final FlowPanel
|
||||
* rightButtonPanel; private final FlowPanel leftButtonPanel;
|
||||
*/
|
||||
private final StringMessages stringMessages;
|
||||
|
||||
private final Button applyToRacelogButton;
|
||||
private final Button cSVExportButton;
|
||||
@@ -39,7 +36,8 @@ public class PairingListCreationDialog extends DataEntryDialog<PairingListTempla
|
||||
|
||||
public PairingListCreationDialog(StrippedLeaderboardDTO leaderboardDTO, final StringMessages stringMessages,
|
||||
PairingListTemplateDTO template, SailingServiceAsync sailingService) {
|
||||
super("Pairing List", null, stringMessages.close(), null, null, null);
|
||||
super(stringMessages.pairingList(), null, stringMessages.close(), null, null, null);
|
||||
this.stringMessages = stringMessages;
|
||||
this.template = template;
|
||||
this.sailingService = sailingService;
|
||||
this.leaderboardDTO = leaderboardDTO;
|
||||
@@ -48,7 +46,7 @@ public class PairingListCreationDialog extends DataEntryDialog<PairingListTempla
|
||||
applyToRacelogButton = new Button(stringMessages.applyToRacelog());
|
||||
cSVExportButton = new Button(stringMessages.csvExport());
|
||||
printViewButton = new Button(stringMessages.printView());
|
||||
|
||||
|
||||
if (template.getCompetitorCount() != leaderboardDTO.competitorsCount) {
|
||||
this.disableApplyToRacelogs();
|
||||
}
|
||||
@@ -61,27 +59,27 @@ public class PairingListCreationDialog extends DataEntryDialog<PairingListTempla
|
||||
/* DATA PANEL */
|
||||
|
||||
CaptionPanel dataPanel = new CaptionPanel();
|
||||
dataPanel.setCaptionText("Pairing List Data");
|
||||
dataPanel.setCaptionText(stringMessages.dataOfPairingList());
|
||||
|
||||
Grid formGrid = new Grid(5, 2);
|
||||
dataPanel.add(formGrid);
|
||||
Label flights =new Label(String.valueOf(this.template.getFlightCount()));
|
||||
Label flights = new Label(String.valueOf(this.template.getFlightCount()));
|
||||
flights.ensureDebugId("FlightCountLabel");
|
||||
Label groups =new Label(String.valueOf(this.template.getGroupCount()));
|
||||
Label groups = new Label(String.valueOf(this.template.getGroupCount()));
|
||||
groups.ensureDebugId("GroupCountLabel");
|
||||
Label competitors =new Label(String.valueOf(this.template.getCompetitorCount()));
|
||||
Label competitors = new Label(String.valueOf(this.template.getCompetitorCount()));
|
||||
competitors.ensureDebugId("CompetitorCountLabel");
|
||||
formGrid.setWidget(0, 0, new Label("Number of Flights:"));
|
||||
formGrid.setWidget(0, 0, new Label(stringMessages.numberOfFlights()));
|
||||
formGrid.setWidget(0, 1, flights);
|
||||
formGrid.setWidget(1, 0, new Label("Number of Groups:"));
|
||||
formGrid.setWidget(1, 0, new Label(stringMessages.numberOfGroups()));
|
||||
formGrid.setWidget(1, 1, groups);
|
||||
formGrid.setWidget(2, 0, new Label("Number of competitors:"));
|
||||
formGrid.setWidget(2, 0, new Label(stringMessages.numberOfCompetitors()));
|
||||
formGrid.setWidget(2, 1, competitors);
|
||||
formGrid.setWidget(3, 0, new Label("Quality:"));
|
||||
formGrid.setWidget(3, 0, new Label(stringMessages.quality()));
|
||||
formGrid.setWidget(3, 1, new Label(String.valueOf(Math.floor(this.template.getQuality() * 1000) / 1000)));
|
||||
if (this.template.getFlightMultiplier() > 1) {
|
||||
Label flightMultiplierLabel = new Label(String.valueOf(this.template.getFlightMultiplier()));
|
||||
formGrid.setWidget(4, 0, new Label("Flight Multiplier:"));
|
||||
Label flightMultiplierLabel = new Label(String.valueOf(this.template.getFlightMultiplier()));
|
||||
formGrid.setWidget(4, 0, new Label(stringMessages.flightMultiplier()));
|
||||
formGrid.setWidget(4, 1, flightMultiplierLabel);
|
||||
flightMultiplierLabel.ensureDebugId("FlightMultiplierCountLabel");
|
||||
}
|
||||
@@ -93,7 +91,7 @@ public class PairingListCreationDialog extends DataEntryDialog<PairingListTempla
|
||||
/* PAIRING LIST TEMPLATE PANEL */
|
||||
|
||||
CaptionPanel pairingListTemplatePanel = new CaptionPanel();
|
||||
pairingListTemplatePanel.setCaptionText("Pairing List Template");
|
||||
pairingListTemplatePanel.setCaptionText(stringMessages.pairingListTemplate());
|
||||
|
||||
Grid pairingListGrid = new Grid(this.template.getPairingListTemplate().length,
|
||||
this.template.getPairingListTemplate()[0].length);
|
||||
@@ -120,13 +118,6 @@ public class PairingListCreationDialog extends DataEntryDialog<PairingListTempla
|
||||
return panel;
|
||||
}
|
||||
|
||||
/*
|
||||
* public void show() { Widget additionalWidget = getAdditionalWidget(); if (additionalWidget != null) {
|
||||
* panelForAdditionalWidget.add(additionalWidget); } validateAndUpdate(); dateEntryDialog.center(); final
|
||||
* FocusWidget focusWidget = getInitialFocusWidget(); if (focusWidget != null) { Scheduler.get().scheduleFinally(new
|
||||
* ScheduledCommand() { @Override public void execute() { focusWidget.setFocus(true); }}); } }
|
||||
*/
|
||||
|
||||
protected PairingListTemplateDTO getResult() {
|
||||
return this.template;
|
||||
}
|
||||
@@ -142,9 +133,9 @@ public class PairingListCreationDialog extends DataEntryDialog<PairingListTempla
|
||||
getRightButtonPannel().add(applyToRacelogButton);
|
||||
getRightButtonPannel().add(cSVExportButton);
|
||||
getRightButtonPannel().add(printViewButton);
|
||||
getRightButtonPannel().add(new HTML("Prints the applied version"));
|
||||
if(!applyToRacelogButton.isEnabled()){
|
||||
Label label=new Label("Registered Competitors are unequal to Competitors from Pairinglist!");
|
||||
getRightButtonPannel().add(new HTML(stringMessages.printHint()));
|
||||
if (!applyToRacelogButton.isEnabled()) {
|
||||
Label label = new Label(stringMessages.blockedApplyButton());
|
||||
label.getElement().getStyle().setColor("red");
|
||||
getRightButtonPannel().add(label);
|
||||
}
|
||||
@@ -152,19 +143,19 @@ public class PairingListCreationDialog extends DataEntryDialog<PairingListTempla
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
sailingService.fillRaceLogsFromPairingListTemplate(leaderboardDTO.getName(), template.getFlightMultiplier(),
|
||||
template.getSelectedFlightNames(), new AsyncCallback<Void>() {
|
||||
sailingService.fillRaceLogsFromPairingListTemplate(leaderboardDTO.getName(),
|
||||
template.getFlightMultiplier(), template.getSelectedFlightNames(), new AsyncCallback<Void>() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(Void result) {
|
||||
System.out.println("it worked ;-)");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
caught.printStackTrace();
|
||||
}
|
||||
});
|
||||
@Override
|
||||
public void onSuccess(Void result) {
|
||||
System.out.println("it worked ;-)");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
caught.printStackTrace();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
@@ -177,10 +168,10 @@ public class PairingListCreationDialog extends DataEntryDialog<PairingListTempla
|
||||
|
||||
});
|
||||
printViewButton.addClickHandler(new ClickHandler() {
|
||||
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
|
||||
|
||||
String link = EntryPointLinkFactory.createPairingListLink(createLinkParameters());
|
||||
Window.open(link, "", "");
|
||||
}
|
||||
@@ -207,11 +198,11 @@ public class PairingListCreationDialog extends DataEntryDialog<PairingListTempla
|
||||
}
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
|
||||
private void disableApplyToRacelogs() {
|
||||
this.applyToRacelogButton.setEnabled(false);
|
||||
}
|
||||
|
||||
|
||||
private Map<String, String> createLinkParameters() {
|
||||
Map<String, String> result = new HashMap<>();
|
||||
result.put("leaderboardName", leaderboardDTO.getName());
|
||||
|
||||
+53
-55
@@ -21,24 +21,24 @@ import com.sap.sse.common.Util;
|
||||
import com.sap.sse.gwt.client.controls.IntegerBox;
|
||||
|
||||
public class PairingListCreationSetupDialog extends AbstractPairingListCreationSetupDialog<PairingListTemplateDTO> {
|
||||
|
||||
|
||||
private final IntegerBox competitorCountTextBox;
|
||||
private final IntegerBox flightMultiplierTextBox;
|
||||
private final CheckBox flightMultiplierCheckBox;
|
||||
private Iterable<CheckBox> selectedSeriesCheckboxes;
|
||||
private final int groupCount;
|
||||
|
||||
|
||||
protected static class PairingListParameterValidator extends AbstractPairingListParameterValidator {
|
||||
public PairingListParameterValidator(StringMessages stringMessages) {
|
||||
super(stringMessages);
|
||||
}
|
||||
}
|
||||
|
||||
public PairingListCreationSetupDialog(StrippedLeaderboardDTO leaderboardDTO, StringMessages stringMessages,
|
||||
|
||||
public PairingListCreationSetupDialog(StrippedLeaderboardDTO leaderboardDTO, StringMessages stringMessages,
|
||||
DialogCallback<PairingListTemplateDTO> callback) {
|
||||
|
||||
super(leaderboardDTO, stringMessages.pairingLists(), stringMessages, new PairingListParameterValidator(stringMessages),
|
||||
callback);
|
||||
|
||||
super(leaderboardDTO, stringMessages.pairingLists(), stringMessages,
|
||||
new PairingListParameterValidator(stringMessages), callback);
|
||||
|
||||
this.groupCount = Util.size(leaderboardDTO.getRaceList().get(0).getFleets());
|
||||
this.competitorCountTextBox = createIntegerBox(leaderboardDTO.competitorsCount, 2);
|
||||
@@ -47,29 +47,29 @@ public class PairingListCreationSetupDialog extends AbstractPairingListCreationS
|
||||
this.flightMultiplierTextBox.setEnabled(false);
|
||||
this.flightMultiplierTextBox.setValue(1);
|
||||
this.flightMultiplierTextBox.ensureDebugId("FlightMultiplierIntegerBox");
|
||||
this.flightMultiplierCheckBox = createCheckbox("Flight Multiplier");
|
||||
this.flightMultiplierCheckBox = createCheckbox(this.stringMessages.flightMultiplier());
|
||||
this.ensureDebugId("PairingListCreationSetupDialog");
|
||||
|
||||
|
||||
this.flightMultiplierCheckBox.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
|
||||
|
||||
|
||||
@Override
|
||||
public void onValueChange(ValueChangeEvent<Boolean> event) {
|
||||
flightMultiplierTextBox.setEnabled(event.getValue());
|
||||
}
|
||||
});
|
||||
flightMultiplierCheckBox.ensureDebugId("CompetitorCountTextBox");
|
||||
|
||||
|
||||
List<CheckBox> checkboxes = new ArrayList<CheckBox>();
|
||||
for(String seriesName : getSeriesNamesFromAllRaces(leaderboardDTO.getRaceList())) {
|
||||
for (String seriesName : getSeriesNamesFromAllRaces(leaderboardDTO.getRaceList())) {
|
||||
CheckBox current = createCheckbox(seriesName);
|
||||
current.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
|
||||
@Override
|
||||
public void onValueChange(ValueChangeEvent<Boolean> event) {
|
||||
if(event.getValue()) {
|
||||
if (event.getValue()) {
|
||||
disableSelectedSeriesCheckBoxes(leaderboardDTO);
|
||||
} else {
|
||||
if(Util.size(getCheckedSelectedCheckBoxes())>0) {
|
||||
|
||||
if (Util.size(getCheckedSelectedCheckBoxes()) > 0) {
|
||||
|
||||
} else {
|
||||
enableAllSelectedSeriesCheckBoxes();
|
||||
}
|
||||
@@ -82,34 +82,33 @@ public class PairingListCreationSetupDialog extends AbstractPairingListCreationS
|
||||
selectedSeriesCheckboxes = checkboxes;
|
||||
this.flightMultiplierCheckBox.ensureDebugId("FlightMultiplierCheckBox");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected Widget getAdditionalWidget() {
|
||||
final VerticalPanel panel = new VerticalPanel();
|
||||
|
||||
|
||||
CaptionPanel infoPanel = new CaptionPanel();
|
||||
infoPanel.setCaptionText("Info");
|
||||
panel.add(infoPanel);
|
||||
|
||||
|
||||
ScrollPanel infoScrollPanel = new ScrollPanel();
|
||||
infoScrollPanel.setPixelSize((Window.getClientWidth() / 3), 150);
|
||||
infoScrollPanel.add(new Label(stringMessages.pairingListCreationInfo()));
|
||||
|
||||
|
||||
infoPanel.add(infoScrollPanel);
|
||||
|
||||
|
||||
Grid formGrid = new Grid(4, 2);
|
||||
panel.add(formGrid);
|
||||
|
||||
//TODO add stringMessages
|
||||
formGrid.setWidget(0, 0, new Label("Please set the competitors count:"));
|
||||
|
||||
formGrid.setWidget(0, 0, new Label(stringMessages.setCompetitors()));
|
||||
formGrid.setWidget(0, 1, this.competitorCountTextBox);
|
||||
formGrid.setWidget(1, 0, this.flightMultiplierCheckBox);
|
||||
formGrid.setWidget(1, 1, this.flightMultiplierTextBox);
|
||||
|
||||
formGrid.setWidget(2, 0, new Label("Please select one or more series that should be in a PairingList:"));
|
||||
|
||||
formGrid.setWidget(2, 0, new Label(stringMessages.seriesHint()));
|
||||
int count = 0;
|
||||
for(CheckBox current : selectedSeriesCheckboxes) {
|
||||
formGrid.setWidget(2+count, 1, current);
|
||||
for (CheckBox current : selectedSeriesCheckboxes) {
|
||||
formGrid.setWidget(2 + count, 1, current);
|
||||
count++;
|
||||
}
|
||||
return panel;
|
||||
@@ -117,18 +116,18 @@ public class PairingListCreationSetupDialog extends AbstractPairingListCreationS
|
||||
|
||||
@Override
|
||||
protected PairingListTemplateDTO getResult() {
|
||||
PairingListTemplateDTO dto = new PairingListTemplateDTO(this.competitorCountTextBox.getValue(),
|
||||
PairingListTemplateDTO dto = new PairingListTemplateDTO(this.competitorCountTextBox.getValue(),
|
||||
this.flightMultiplierTextBox.getValue());
|
||||
dto.setGroupCount(this.groupCount);
|
||||
|
||||
|
||||
int flightCount = 0;
|
||||
|
||||
|
||||
for (RaceColumnDTO raceColumn : leaderboardDTO.getRaceList()) {
|
||||
if (!raceColumn.isMedalRace()) {
|
||||
flightCount++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
dto.setFlightCount(flightCount);
|
||||
|
||||
if (this.flightMultiplierCheckBox.getValue()) {
|
||||
@@ -141,21 +140,19 @@ public class PairingListCreationSetupDialog extends AbstractPairingListCreationS
|
||||
for (CheckBox box : getCheckedSelectedCheckBoxes()) {
|
||||
selectedFlightNames.addAll(getRaceColumnNamesFromSeriesName(box.getText(), leaderboardDTO.getRaceList()));
|
||||
}
|
||||
|
||||
|
||||
dto.setSelectedFlightNames(selectedFlightNames);
|
||||
|
||||
return dto;
|
||||
|
||||
return dto;
|
||||
}
|
||||
|
||||
|
||||
public void setDefaultCompetitorCount(int competitorCount) {
|
||||
if (this.competitorCountTextBox.getValue() == 0) {
|
||||
this.competitorCountTextBox.setValue(competitorCount);
|
||||
this.validateAndUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
//private void changeFlights
|
||||
|
||||
|
||||
// filter medal race
|
||||
private Iterable<String> getSeriesNamesFromAllRaces(Iterable<RaceColumnDTO> raceColumns) {
|
||||
List<String> result = new ArrayList<>();
|
||||
@@ -172,55 +169,56 @@ public class PairingListCreationSetupDialog extends AbstractPairingListCreationS
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
private RaceColumnDTO getOneRaceFromSeriesName(String seriesName, Iterable<RaceColumnDTO> raceColumns) {
|
||||
for(RaceColumnDTO raceColumn : raceColumns) {
|
||||
if(!raceColumn.isMedalRace() && seriesName.equals(raceColumn.getSeriesName())) {
|
||||
for (RaceColumnDTO raceColumn : raceColumns) {
|
||||
if (!raceColumn.isMedalRace() && seriesName.equals(raceColumn.getSeriesName())) {
|
||||
return raceColumn;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
private List<String> getRaceColumnNamesFromSeriesName(String seriesName, Iterable<RaceColumnDTO> raceColumns) {
|
||||
List<String> result = new ArrayList<>();
|
||||
for(RaceColumnDTO raceColumn : raceColumns) {
|
||||
if(!raceColumn.isMedalRace() && seriesName.equals(raceColumn.getSeriesName())) {
|
||||
for (RaceColumnDTO raceColumn : raceColumns) {
|
||||
if (!raceColumn.isMedalRace() && seriesName.equals(raceColumn.getSeriesName())) {
|
||||
result.add(raceColumn.getName());
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
public Iterable<CheckBox> getCheckedSelectedCheckBoxes() {
|
||||
List<CheckBox> result = new ArrayList<>();
|
||||
for(CheckBox box : selectedSeriesCheckboxes) {
|
||||
if(box.getValue()) {
|
||||
for (CheckBox box : selectedSeriesCheckboxes) {
|
||||
if (box.getValue()) {
|
||||
result.add(box);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
private void disableSelectedSeriesCheckBoxes(StrippedLeaderboardDTO leaderboardDTO) {
|
||||
Iterable<CheckBox> boxes = getCheckedSelectedCheckBoxes();
|
||||
if(Util.size(boxes)>1) {
|
||||
if (Util.size(boxes) > 1) {
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
RaceColumnDTO race = getOneRaceFromSeriesName(Util.get(boxes, 0).getText(), leaderboardDTO.getRaceList());
|
||||
for(CheckBox box : selectedSeriesCheckboxes) {
|
||||
if(race.getFleets().size() == getOneRaceFromSeriesName(box.getText(), leaderboardDTO.getRaceList()).getFleets().size()) {
|
||||
|
||||
for (CheckBox box : selectedSeriesCheckboxes) {
|
||||
if (race.getFleets().size() == getOneRaceFromSeriesName(box.getText(), leaderboardDTO.getRaceList())
|
||||
.getFleets().size()) {
|
||||
|
||||
} else {
|
||||
box.setEnabled(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void enableAllSelectedSeriesCheckBoxes() {
|
||||
for(CheckBox box : selectedSeriesCheckboxes) {
|
||||
for (CheckBox box : selectedSeriesCheckboxes) {
|
||||
box.setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
+15
@@ -235,9 +235,24 @@ public interface StringMessages extends com.sap.sse.gwt.client.StringMessages,
|
||||
String pairingList();
|
||||
String pairingLists();
|
||||
String pairingListCreationInfo();
|
||||
String setCompetitors();
|
||||
String seriesHint();
|
||||
String flightMultiplier();
|
||||
String applyToRacelog();
|
||||
String csvExport();
|
||||
String printView();
|
||||
String invalidCompetitorCount();
|
||||
String invalidFlightMultiplier();
|
||||
String invalidSeriesSelection();
|
||||
String flightsMustBeAMultipleOfMultiplier();
|
||||
String dataOfPairingList();
|
||||
String numberOfFlights();
|
||||
String numberOfGroups();
|
||||
String numberOfCompetitors();
|
||||
String quality();
|
||||
String pairingListTemplate();
|
||||
String printHint();
|
||||
String blockedApplyButton();
|
||||
String settingsForComponent(String localizedComponentName);
|
||||
String noEventsFound();
|
||||
String noEventSelected();
|
||||
|
||||
+15
@@ -238,9 +238,24 @@ pairingLists=Pairing Lists
|
||||
pairingListCreationInfo=First of all a template will be calculated that contains only the competitor numbers and can be applied to other leaderboards. If the competitor count is not divisible by the boat count without remainder, empty placeholders will be entered into the pairing list. \
|
||||
\ In addition if the competitor count is unequal to the registered competitor count in the actual leaderboard, the pairing list cannot be applied to Race logs. \
|
||||
\ The count of the flights, that is used to generate a pairing list, is set by all flights of the leaderboard that are not medal races.
|
||||
setCompetitors=Please set the competitors count:
|
||||
seriesHint=Please select one or more series that should be in a PairingList:
|
||||
flightMultiplier=Flight Multiplier
|
||||
applyToRacelog=Apply to Racelog
|
||||
csvExport=Export as CSV
|
||||
printView=Print view
|
||||
invalidCompetitorCount=Invalid competitor count
|
||||
invalidFlightMultiplier=Invalid flight multiplier
|
||||
invalidSeriesSelection=Invalid series selection
|
||||
flightsMustBeAMultipleOfMultiplier=Flights has to be a multiple of flight multiplier
|
||||
dataOfPairingList=Data of Pairinglist
|
||||
numberOfFlights=Number of Flights
|
||||
numberOfGroups=Number of Groups
|
||||
numberOfCompetitors=Number of Competiors
|
||||
quality=Quality
|
||||
pairingListTemplate=Pairinglist Template
|
||||
printHint=Prints the applied version
|
||||
blockedApplyButton=Registered Competitors are unequal to Competitors from Pairinglist!
|
||||
settingsForComponent=Settings for {0}
|
||||
noEventsFound=No events were found
|
||||
noEventSelected=No event selected
|
||||
|
||||
+15
@@ -240,9 +240,24 @@ pairingLists=Gegner Paarungslisten
|
||||
pairingListCreationInfo=Es wird zunächst ein Template berechnet, das nur aus Zahlen besteht. Wenn die Teilnehmer Anzahl nicht durch die Anzahl der Boote dividiert werden kann, entstehen leere Plätze in der Pairing List. \
|
||||
\ Wenn außerdem die Anzahl der Teilnehmer nicht der auf der Rangliste registrierten Teilnehmer Anzahl entspricht, kann die Pairing List nicht in die Race Logs eingetragen werden. \
|
||||
\ Es wird eine Vereinigungsmenge aus allen Rennen, die keine Medallien Rennen sind, als Rennenanzahl für die Pairing List gebildet.
|
||||
setCompetitors=Anzahl der Teilnehmer:
|
||||
seriesHint=Bitte wählen Sie eine oder mehr Serien für die eine Paarungsliste aus:
|
||||
flightMultiplier= Wiederholungsfaktor
|
||||
applyToRacelog=Anwenden auf Race log
|
||||
csvExport=Export als CSV
|
||||
printView=Druckansicht
|
||||
invalidCompetitorCount=Ungültige Teilnehmeranzahl
|
||||
invalidFlightMultiplier=Ungültiger Wiederholungsfaktor
|
||||
invalidSeriesSelection=Ungültige Serienauswahl
|
||||
flightsMustBeAMultipleOfMultiplier=Anzahl der Wettfahren muss ein Vielfaches vom Wiederholungsfaktor sein
|
||||
dataOfPairingList=Daten der Paarungsliste
|
||||
numberOfFlights=Anzahl der Wettfahrten
|
||||
numberOfGroups=Anzahl der Rennen pro Wettfahrt
|
||||
numberOfCompetitors=Anzahl der Teilnehmer
|
||||
quality=Qualität
|
||||
pairingListTemplate=Paarungsliste
|
||||
printHint=Druckt die aktuell angewendete Version!
|
||||
blockedApplyButton=Die Anzahl der Teilnehmer der Paarungliste ist ungleich den registrierten Teilnehmern!
|
||||
settingsForComponent=Einstellungen für {0}
|
||||
noEventsFound=Es wurden keine Rennen gefunden
|
||||
noEventSelected=Kein Rennen ausgewählt
|
||||
|
||||
+27
-24
@@ -42,6 +42,7 @@ public class PairinglistTest extends AbstractSeleniumTest {
|
||||
clearState(getContextRoot());
|
||||
super.setUp();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createEventAndTestPOForCalculation() {
|
||||
final RegattaDescriptor regattaDescriptor = new RegattaDescriptor(REGATTA_49ER, BOAT_CLASS_49ER);
|
||||
@@ -69,7 +70,8 @@ public class PairinglistTest extends AbstractSeleniumTest {
|
||||
editSeriesMedals.pressOk();
|
||||
LeaderboardConfigurationPanelPO leaderboardConfigurationPanelPO = adminConsolePage
|
||||
.goToLeaderboardConfiguration();
|
||||
LeaderboardEntryPO leaderboardEntryPO=leaderboardConfigurationPanelPO.getLeaderboardTable().getEntry(REGATTA_49ER_WITH_SUFFIX);
|
||||
LeaderboardEntryPO leaderboardEntryPO = leaderboardConfigurationPanelPO.getLeaderboardTable()
|
||||
.getEntry(REGATTA_49ER_WITH_SUFFIX);
|
||||
PairingListCreationSetupDialogPO dialog = leaderboardEntryPO.getLeaderboardPairingListCreationSetupDialog();
|
||||
Assert.assertTrue(!dialog.isOkButtonEnabled());
|
||||
dialog.setCompetitorsCount("1");
|
||||
@@ -82,32 +84,33 @@ public class PairinglistTest extends AbstractSeleniumTest {
|
||||
dialog.setCompetitorsCount("18");
|
||||
Assert.assertTrue(dialog.isOkButtonEnabled());
|
||||
PairinfListCreationDialogPO dialog2 = dialog.pressOk();
|
||||
Assert.assertEquals("12",dialog2.getValueOfFlightsLabel());
|
||||
Assert.assertEquals("12", dialog2.getValueOfFlightsLabel());
|
||||
Assert.assertEquals("1", dialog2.getValueOfGroupsLabel());
|
||||
Assert.assertEquals("18", dialog2.getValueOfCompetitorsLabel());
|
||||
dialog2.pressClose();
|
||||
dialog2.pressClose();
|
||||
}
|
||||
{
|
||||
AdminConsolePage adminConsolePage = AdminConsolePage.goToPage(getWebDriver(), getContextRoot());
|
||||
LeaderboardConfigurationPanelPO leaderboardConfigurationPanelPO = adminConsolePage
|
||||
.goToLeaderboardConfiguration();
|
||||
LeaderboardEntryPO leaderboardEntryPO=leaderboardConfigurationPanelPO.getLeaderboardTable().getEntry(REGATTA_49ER_WITH_SUFFIX);
|
||||
PairingListCreationSetupDialogPO dialog = leaderboardEntryPO.getLeaderboardPairingListCreationSetupDialog();
|
||||
dialog.setCompetitorsCount("18");
|
||||
Assert.assertTrue(!dialog.isFlightMultiplierBoxEnabled());
|
||||
dialog.clickFlightMultiplierCheckBox();
|
||||
Assert.assertTrue(dialog.isFlightMultiplierBoxEnabled());
|
||||
dialog.setFlightMultiplier("0");
|
||||
Assert.assertTrue(!dialog.isOkButtonEnabled());
|
||||
dialog.setFlightMultiplier("2");
|
||||
dialog.clickFlightCheckBox();
|
||||
Assert.assertTrue(dialog.isOkButtonEnabled());
|
||||
PairinfListCreationDialogPO dialog2 = dialog.pressOk();
|
||||
Assert.assertEquals("12",dialog2.getValueOfFlightsLabel());
|
||||
Assert.assertEquals("1", dialog2.getValueOfGroupsLabel());
|
||||
Assert.assertEquals("18", dialog2.getValueOfCompetitorsLabel());
|
||||
Assert.assertEquals("2", dialog2.getValueOfMultiplerLabel());
|
||||
dialog2.pressClose();
|
||||
}
|
||||
AdminConsolePage adminConsolePage = AdminConsolePage.goToPage(getWebDriver(), getContextRoot());
|
||||
LeaderboardConfigurationPanelPO leaderboardConfigurationPanelPO = adminConsolePage
|
||||
.goToLeaderboardConfiguration();
|
||||
LeaderboardEntryPO leaderboardEntryPO = leaderboardConfigurationPanelPO.getLeaderboardTable()
|
||||
.getEntry(REGATTA_49ER_WITH_SUFFIX);
|
||||
PairingListCreationSetupDialogPO dialog = leaderboardEntryPO.getLeaderboardPairingListCreationSetupDialog();
|
||||
dialog.setCompetitorsCount("18");
|
||||
Assert.assertTrue(!dialog.isFlightMultiplierBoxEnabled());
|
||||
dialog.clickFlightMultiplierCheckBox();
|
||||
Assert.assertTrue(dialog.isFlightMultiplierBoxEnabled());
|
||||
dialog.setFlightMultiplier("0");
|
||||
Assert.assertTrue(!dialog.isOkButtonEnabled());
|
||||
dialog.setFlightMultiplier("2");
|
||||
dialog.clickFlightCheckBox();
|
||||
Assert.assertTrue(dialog.isOkButtonEnabled());
|
||||
PairinfListCreationDialogPO dialog2 = dialog.pressOk();
|
||||
Assert.assertEquals("12", dialog2.getValueOfFlightsLabel());
|
||||
Assert.assertEquals("1", dialog2.getValueOfGroupsLabel());
|
||||
Assert.assertEquals("18", dialog2.getValueOfCompetitorsLabel());
|
||||
Assert.assertEquals("2", dialog2.getValueOfMultiplerLabel());
|
||||
dialog2.pressClose();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,37 +16,6 @@ public class PairingListTemplateTest extends PairingListTemplateImpl {
|
||||
super(new PairingFrameProviderTest(15, 3, 18));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testArrayCopy() {
|
||||
|
||||
int[][] flightColumn = { { 0, 1, 2, 3, 4, 5 }, { 6, 7, 8, 9, 10, 11 }, { 12, 13, 14, 15, 16, 17 } };
|
||||
|
||||
int[][][] associationRow = new int[3][5][18];
|
||||
int[][] currentAssociations = { { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17 },
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17 },
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, };
|
||||
|
||||
this.copyInto3rdDimension(18, currentAssociations, associationRow, flightColumn, 1, 0);
|
||||
assertArrayEquals(currentAssociations[0], associationRow[0][0]);
|
||||
this.copyInto3rdDimension(18, currentAssociations, associationRow, flightColumn, 1, 1);
|
||||
assertArrayEquals(currentAssociations[6], associationRow[1][0]);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTeamAssociationCreation() {
|
||||
final int flights = 15;
|
||||
|
||||
@@ -327,15 +327,10 @@ public class PairingListTemplateImpl implements PairingListTemplate {
|
||||
Arrays.fill(group, -1);
|
||||
}
|
||||
boolean[] contains = new boolean[competitorCount];
|
||||
// LinkedList<Integer> competitors=new LinkedList<>();
|
||||
// for(int competitor=0;competitor<competitorCount;competitor++){
|
||||
// competitors.add(competitor);
|
||||
// }
|
||||
if (groupCount > 1) {
|
||||
int[] associationHigh = new int[groupCount - 1];
|
||||
flightColumn[0][0] = seed;
|
||||
contains[seed] = true;
|
||||
// competitors.remove((Integer)seed);
|
||||
int[] sumsOf3rdDemension = new int[competitorCount];
|
||||
System.arraycopy(currentAssociations[seed], 0, sumsOf3rdDemension, 0, competitorCount);
|
||||
int[] maxValues = new int[competitorCount];
|
||||
@@ -343,7 +338,6 @@ public class PairingListTemplateImpl implements PairingListTemplate {
|
||||
for (int assignmentIndex = 1; assignmentIndex < (competitorCount / groupCount); assignmentIndex++) {
|
||||
int associationSum = Integer.MAX_VALUE;
|
||||
associationHigh[0] = Integer.MAX_VALUE;
|
||||
// for(int competitorIndex:competitors) {
|
||||
for (int competitorIndex = 0; competitorIndex < competitorCount; competitorIndex++) {
|
||||
if (sumsOf3rdDemension[competitorIndex] <= associationSum && !contains[competitorIndex]
|
||||
&& maxValues[competitorIndex] <= associationHigh[0]) {
|
||||
@@ -354,7 +348,6 @@ public class PairingListTemplateImpl implements PairingListTemplate {
|
||||
}
|
||||
}
|
||||
contains[flightColumn[0][assignmentIndex]] = true;
|
||||
// competitors.remove((Integer)flightColumn[0][assignmentIndex]);
|
||||
for (int competitor = 0; competitor < competitorCount; competitor++) {
|
||||
if (flightColumn[0][assignmentIndex] != competitor) {
|
||||
sumsOf3rdDemension[competitor] += currentAssociations[flightColumn[0][assignmentIndex]][competitor];
|
||||
@@ -365,8 +358,6 @@ public class PairingListTemplateImpl implements PairingListTemplate {
|
||||
}
|
||||
}
|
||||
for (int groupIndex = 1; groupIndex < groupCount - 1; groupIndex++) {
|
||||
// flightColumn[groupIndex][0]=competitors.get(0);
|
||||
// competitors.remove(0);
|
||||
for (int competitorIndex = 0; competitorIndex < competitorCount; competitorIndex++) {
|
||||
if (!contains[competitorIndex]) {
|
||||
flightColumn[groupIndex][0] = competitorIndex;
|
||||
@@ -383,7 +374,6 @@ public class PairingListTemplateImpl implements PairingListTemplate {
|
||||
int associationSum = Integer.MAX_VALUE;
|
||||
associationHigh[groupIndex] = Integer.MAX_VALUE;
|
||||
|
||||
// for (int competitorIndex:competitors) {
|
||||
for (int competitorIndex = 0; competitorIndex < competitorCount; competitorIndex++) {
|
||||
if (sumsOf3rdDemension[competitorIndex] <= associationSum && !contains[competitorIndex]
|
||||
&& maxValues[competitorIndex] <= associationHigh[groupIndex]) {
|
||||
@@ -392,7 +382,6 @@ public class PairingListTemplateImpl implements PairingListTemplate {
|
||||
associationHigh[groupIndex] = maxValues[competitorIndex];
|
||||
}
|
||||
}
|
||||
// competitors.remove((Integer)flightColumn[groupIndex][assignmentIndex]);
|
||||
contains[flightColumn[groupIndex][assignmentIndex]] = true;
|
||||
for (int competitor = 0; competitor < competitorCount; competitor++) {
|
||||
if (flightColumn[groupIndex][assignmentIndex] != competitor) {
|
||||
@@ -405,16 +394,13 @@ public class PairingListTemplateImpl implements PairingListTemplate {
|
||||
}
|
||||
}
|
||||
}
|
||||
// last Flight
|
||||
for (int assignmentIndex = 0; assignmentIndex < (competitorCount / groupCount); assignmentIndex++) {
|
||||
// for (int competitorIndex:competitors) {
|
||||
for (int competitorIndex = 0; competitorIndex < competitorCount; competitorIndex++) {
|
||||
if (!contains[competitorIndex]) {
|
||||
flightColumn[groupCount - 1][assignmentIndex] = competitorIndex;
|
||||
}
|
||||
}
|
||||
contains[flightColumn[groupCount - 1][assignmentIndex]] = true;
|
||||
// competitors.remove((Integer)flightColumn[groupCount - 1][assignmentIndex]);
|
||||
}
|
||||
return flightColumn;
|
||||
}
|
||||
@@ -563,7 +549,7 @@ public class PairingListTemplateImpl implements PairingListTemplate {
|
||||
* @return the improved pairingListTemplate
|
||||
*/
|
||||
private int[][] improveAssignmentChanges(int[][] pairingList, int flights, int competitors) {
|
||||
int boatChanges[] = new int[flights-1];
|
||||
int boatChanges[] = new int[flights - 1];
|
||||
|
||||
for (int i = 1; i < flights; i++) {
|
||||
int[] groupPrev = pairingList[i * pairingList.length / flights - 1];
|
||||
@@ -584,9 +570,10 @@ public class PairingListTemplateImpl implements PairingListTemplate {
|
||||
int[] temp = new int[pairingList[0].length];
|
||||
System.arraycopy(pairingList[i * pairingList.length / flights], 0, temp, 0, temp.length);
|
||||
|
||||
System.arraycopy(pairingList[i * pairingList.length / flights+ bestMatchesIndex], 0,
|
||||
pairingList[i * pairingList.length / flights ], 0, groupNext.length);
|
||||
System.arraycopy(temp, 0, pairingList[i * pairingList.length / flights + bestMatchesIndex], 0, temp.length);
|
||||
System.arraycopy(pairingList[i * pairingList.length / flights + bestMatchesIndex], 0,
|
||||
pairingList[i * pairingList.length / flights], 0, groupNext.length);
|
||||
System.arraycopy(temp, 0, pairingList[i * pairingList.length / flights + bestMatchesIndex], 0,
|
||||
temp.length);
|
||||
}
|
||||
|
||||
boatChanges[i - 1] = groupNext.length - bestMatch;
|
||||
@@ -597,7 +584,7 @@ public class PairingListTemplateImpl implements PairingListTemplate {
|
||||
private int getMatches(int[] arr1, int[] arr2) {
|
||||
int matches = 0;
|
||||
|
||||
for (int value: arr1) {
|
||||
for (int value : arr1) {
|
||||
if (this.contains(arr2, value)) {
|
||||
matches++;
|
||||
}
|
||||
@@ -605,14 +592,15 @@ public class PairingListTemplateImpl implements PairingListTemplate {
|
||||
|
||||
return matches;
|
||||
}
|
||||
|
||||
|
||||
private int[][] multiplyFlights(int[][] bestPLT, int flightCount, int groupCount, int competitorCount) {
|
||||
int[][] result = new int[((flightCount*flightMultiplier) * groupCount)][competitorCount / groupCount];
|
||||
|
||||
int[][] result = new int[((flightCount * flightMultiplier) * groupCount)][competitorCount / groupCount];
|
||||
|
||||
for (int flightIndex = 0; flightIndex < flightCount; flightIndex++) {
|
||||
for (int x = 0; x < flightMultiplier; x++) {
|
||||
for (int groupIndex = 0; groupIndex < groupCount; groupIndex++) {
|
||||
result[(flightIndex * groupCount * (flightMultiplier) + groupIndex) + x * groupCount] = bestPLT[flightIndex * groupCount + groupIndex];
|
||||
result[(flightIndex * groupCount * (flightMultiplier) + groupIndex)
|
||||
+ x * groupCount] = bestPLT[flightIndex * groupCount + groupIndex];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -641,14 +629,6 @@ public class PairingListTemplateImpl implements PairingListTemplate {
|
||||
}
|
||||
return worstValuePos;
|
||||
}
|
||||
|
||||
protected int[][][] copyInto3rdDimension(int competitors, int[][] currentAssociations, int[][][] associationRow,
|
||||
int[][] flightColumn, int zGroups, int fleet) {
|
||||
System.arraycopy(currentAssociations[flightColumn[fleet][zGroups - 1]], 0, associationRow[fleet][zGroups - 1],
|
||||
0, competitors);
|
||||
return associationRow;
|
||||
}
|
||||
|
||||
|
||||
private boolean contains(int[] arr, int value) {
|
||||
for (int i = 0; i < arr.length; i++) {
|
||||
@@ -768,7 +748,11 @@ public class PairingListTemplateImpl implements PairingListTemplate {
|
||||
|
||||
return standardDev;
|
||||
}
|
||||
|
||||
/**
|
||||
* This Method replaces the given number of dummy competitors with -1, so they are not longer valid and could not be read on client side.
|
||||
* @param bestPLT actual pairinglist, which should be modified
|
||||
* @return the modified pairinglist
|
||||
*/
|
||||
private int[][] resetDummies(int[][] bestPLT, int competitorCount) {
|
||||
if (dummies > 0) {
|
||||
int[] dummyCompetitors = new int[dummies];
|
||||
|
||||
Reference in new issue
Block a user