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

Conversation

firefly2442
Copy link
Contributor

…sults for skill level for mass training, fixes issue #5922

Second attempt here at a fix.

I assume Elite level personnel should be selectable as a dropdown in the filter for mass training? Without this fix, Elite does not show up in the dropdown. This also correctly shows the right personnel given the example save provided in the referenced issue.

If I'm misunderstanding something here, please correct me.

…sults for skill level for mass training, fixes issue MegaMek#5922
@codecov-commenter
Copy link

codecov-commenter commented Feb 6, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 10.32%. Comparing base (bffc2b3) to head (fff3c87).
Report is 19 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #5994      +/-   ##
============================================
+ Coverage     10.29%   10.32%   +0.03%     
- Complexity     6108     6118      +10     
============================================
  Files          1038     1038              
  Lines        139302   139295       -7     
  Branches      20664    20662       -2     
============================================
+ Hits          14337    14389      +52     
+ Misses       123533   123466      -67     
- Partials       1432     1440       +8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@IllianiCBT IllianiCBT left a comment

Choose a reason for hiding this comment

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

A small change to reduce redundancy. Otherwise, while we'll need to test this, it looks ok.

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()));

@IllianiCBT IllianiCBT merged commit c722ce7 into MegaMek:master Feb 8, 2025
4 checks passed
@firefly2442 firefly2442 deleted the mass-training-filter-bug branch February 8, 2025 03:49
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.

3 participants