Skip to content
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

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from

Conversation

K-ETFreeman
Copy link
Contributor

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.
image
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.

Comment on lines 33 to 37
public Spinner<Integer> vetoTokensPerPlayerSpinner;
public Spinner<Integer> maxTokensPerMapSpinner;
public Spinner<Double> minimumMapsAfterVetoSpinner;
public CheckBox dynamicMaxTokensPerMapCheckBox;
public HBox maxTokensPerMapHBox;
Copy link
Member

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()));
Copy link
Member

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

Comment on lines 69 to 71
bracket.maxTokensPerMapProperty().set(0);
} else {
bracket.maxTokensPerMapProperty().set(1);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
bracket.maxTokensPerMapProperty().set(0);
} else {
bracket.maxTokensPerMapProperty().set(1);
bracket.setMaxTokensPerMap(0);
} else {
bracket.setMaxTokensPerMap(1);

}
});

dynamicMaxTokensPerMapCheckBox.setSelected(bracket.maxTokensPerMapProperty().get() == 0);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
dynamicMaxTokensPerMapCheckBox.setSelected(bracket.maxTokensPerMapProperty().get() == 0);
dynamicMaxTokensPerMapCheckBox.setSelected(bracket.getMaxTokensPerMap() == 0);


dynamicMaxTokensPerMapCheckBox.setSelected(bracket.maxTokensPerMapProperty().get() == 0);

maxTokensPerMapSpinner.getValueFactory().setValue(bracket.maxTokensPerMapProperty().get());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
vetoTokensPerPlayerSpinner.getValueFactory().setValue(bracket.vetoTokensPerPlayerProperty().get());
vetoTokensPerPlayerSpinner.getValueFactory().setValue(bracket.getVetoTokensPerPlayer());

Comment on lines 196 to 205
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);
Copy link
Member

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

Copy link
Member

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;
Copy link
Member

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

@K-ETFreeman K-ETFreeman requested a review from Sheikah45 December 3, 2024 18:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ability to set Veto System fields by MM team
2 participants