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

fix: addresses the off by one issue presenting the wrong filtering re… #5994

Merged
merged 2 commits into from
Feb 8, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions MekHQ/src/mekhq/gui/dialog/BatchXPDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@ private JComponent getButtonPanel() {
choiceExp.setMaximumSize(new Dimension(Short.MAX_VALUE, (int) choiceType.getPreferredSize().getHeight()));
DefaultComboBoxModel<PersonTypeItem> personExpModel = new DefaultComboBoxModel<>();
personExpModel.addElement(new PersonTypeItem(resourceMap.getString("experience.choice.text"), null));
for (int i = SkillLevel.ULTRA_GREEN.ordinal(); i < SkillLevel.ELITE.ordinal(); i++) {
personExpModel.addElement(new PersonTypeItem(Skills.SKILL_LEVELS[i].toString(), i));
for (int i = SkillLevel.ULTRA_GREEN.ordinal(); i <= SkillLevel.ELITE.ordinal(); i++) {
personExpModel.addElement(new PersonTypeItem(SkillLevel.parseFromInteger(i).toString(), SkillLevel.parseFromInteger(i).getAdjustedValue()));
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should probably be storing SkillLevel.parseFromInteger in a variable so we don't have to fetch it twice.

Something like...

final SkillLevel skillLevel = SkillLevel.parseFromInteger(i);
personExpModel.addElement(new PersonTypeItem(skillLevel.toString(), skillLevel.getAdjustedValue()));

}
choiceExp.setModel(personExpModel);
choiceExp.setSelectedIndex(0);
Expand Down