-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/setting veto system fields #229
base: develop
Are you sure you want to change the base?
Feature/setting veto system fields #229
Conversation
src/main/java/com/faforever/moderatorclient/ui/main_window/BracketListViewController.java
Outdated
Show resolved
Hide resolved
src/main/java/com/faforever/moderatorclient/ui/main_window/BracketListViewController.java
Outdated
Show resolved
Hide resolved
src/main/java/com/faforever/moderatorclient/ui/main_window/BracketListViewController.java
Outdated
Show resolved
Hide resolved
public Spinner<Integer> vetoTokensPerPlayerSpinner; | ||
public Spinner<Integer> maxTokensPerMapSpinner; | ||
public Spinner<Double> minimumMapsAfterVetoSpinner; | ||
public CheckBox dynamicMaxTokensPerMapCheckBox; | ||
public HBox maxTokensPerMapHBox; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would follow convention and make these not public and use @FXML
public void bindVetoParams(MatchmakerQueueMapPoolFX bracket) { | ||
dynamicMaxTokensPerMapCheckBox.selectedProperty().addListener((observable, oldValue, newValue) -> { | ||
if (newValue){ | ||
log.debug(String.valueOf(bracket.maxTokensPerMapProperty().get())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This log statement isn't needed anymore
bracket.maxTokensPerMapProperty().set(0); | ||
} else { | ||
bracket.maxTokensPerMapProperty().set(1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bracket.maxTokensPerMapProperty().set(0); | |
} else { | |
bracket.maxTokensPerMapProperty().set(1); | |
bracket.setMaxTokensPerMap(0); | |
} else { | |
bracket.setMaxTokensPerMap(1); |
} | ||
}); | ||
|
||
dynamicMaxTokensPerMapCheckBox.setSelected(bracket.maxTokensPerMapProperty().get() == 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dynamicMaxTokensPerMapCheckBox.setSelected(bracket.maxTokensPerMapProperty().get() == 0); | |
dynamicMaxTokensPerMapCheckBox.setSelected(bracket.getMaxTokensPerMap() == 0); |
|
||
dynamicMaxTokensPerMapCheckBox.setSelected(bracket.maxTokensPerMapProperty().get() == 0); | ||
|
||
maxTokensPerMapSpinner.getValueFactory().setValue(bracket.maxTokensPerMapProperty().get()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maxTokensPerMapSpinner.getValueFactory().setValue(bracket.maxTokensPerMapProperty().get()); | |
maxTokensPerMapSpinner.getValueFactory().setValue(bracket.getMaxTokensPerMap()); |
vetoTokensPerPlayerSpinner.valueProperty().addListener((observable, oldValue, newValue) -> bracket.vetoTokensPerPlayerProperty().set(newValue)); | ||
|
||
minimumMapsAfterVetoSpinner.getValueFactory().setValue(bracket.minimumMapsAfterVetoProperty().get()); | ||
minimumMapsAfterVetoSpinner.valueProperty().addListener((observable, oldValue, newValue) -> bracket.minimumMapsAfterVetoProperty().set(newValue)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minimumMapsAfterVetoSpinner.valueProperty().addListener((observable, oldValue, newValue) -> bracket.minimumMapsAfterVetoProperty().set(newValue)); | |
minimumMapsAfterVetoSpinner.valueProperty().addListener((observable, oldValue, newValue) -> bracket.setMinimumMapsAfterVeto(newValue)); |
vetoTokensPerPlayerSpinner.getValueFactory().setValue(bracket.vetoTokensPerPlayerProperty().get()); | ||
vetoTokensPerPlayerSpinner.valueProperty().addListener((observable, oldValue, newValue) -> bracket.vetoTokensPerPlayerProperty().set(newValue)); | ||
|
||
minimumMapsAfterVetoSpinner.getValueFactory().setValue(bracket.minimumMapsAfterVetoProperty().get()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minimumMapsAfterVetoSpinner.getValueFactory().setValue(bracket.minimumMapsAfterVetoProperty().get()); | |
minimumMapsAfterVetoSpinner.getValueFactory().setValue(bracket.getMinimumMapsAfterVeto()); |
maxTokensPerMapSpinner.getValueFactory().setValue(bracket.maxTokensPerMapProperty().get()); | ||
maxTokensPerMapSpinner.valueProperty().addListener((observable, oldValue, newValue) -> bracket.maxTokensPerMapProperty().set(newValue)); | ||
|
||
vetoTokensPerPlayerSpinner.getValueFactory().setValue(bracket.vetoTokensPerPlayerProperty().get()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
vetoTokensPerPlayerSpinner.getValueFactory().setValue(bracket.vetoTokensPerPlayerProperty().get()); | |
vetoTokensPerPlayerSpinner.getValueFactory().setValue(bracket.getVetoTokensPerPlayer()); |
ElideNavigatorOnId<MatchmakerQueueMapPool> navigator = ElideNavigator.of(MatchmakerQueueMapPool.class) | ||
.id(bracketFX.getId()); | ||
MatchmakerQueueMapPool dto = matchmakerQueueMapPoolMapper.mapToDto(bracketFX); | ||
dto.setMapPool(null); | ||
dto.setCreateTime(null); | ||
dto.setMinRating(null); | ||
dto.setMaxRating(null); | ||
dto.setMatchmakerQueue(null); | ||
dto.setUpdateTime(null); | ||
apiService.patch(navigator, dto); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be a method inside mapService
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
like the changes to mappoolassignments below
@@ -64,6 +67,7 @@ public class LadderMapPoolController implements Controller<SplitPane> { | |||
public static final double MIN_MAP_SIZE_STEP = 1.25; | |||
private final MapService mapService; | |||
private final UiService uiService; | |||
private final FafApiCommunicationService apiService; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should only need mapService
fixes #227
requires updated database and api with veto system fields updates
maxTokenPerMap: set "D" into the field as "Dynamic". I think this is more clear than 0.
Under the hood, D transforms to 0 anyway. Would be nice to have null instead of 0, but not possible currently due to patch request limitations in current api-service code.