-
Notifications
You must be signed in to change notification settings - Fork 176
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
Disable Advance Day Button While Advance Day is in Progress #5355
Conversation
Added logic to disable the Advance Day button to prevent multiple activations while the action is still ongoing. Re-enabled the button after the process completes, ensuring proper functionality and avoiding unintended behavior.
MekHQ/src/mekhq/gui/CampaignGUI.java
Outdated
.append(tech.getDailyAvailableTechTime()) | ||
.append(" minutes</html>"); | ||
name = nameBuilder.toString(); | ||
String nameBuilder = "<html>" + tech.getFullName() + ", <b>" + SkillType.getColoredExperienceLevelName(tech.getSkillLevel(getCampaign(), false)) + "</b> " + tech.getPrimaryRoleDesc() + " (" + getCampaign().getTargetFor(r, tech).getValueAsString() + "+), " + tech.getMinutesLeft() + '/' + tech.getDailyAvailableTechTime() + " minutes</html>"; |
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 seems less clean, plus if we're not using a StringBuilder you can just concatenate everything into name
and skip the second line.
Was this an IDE-suggested change? Apparently most will turn this form into the StringBuilder form under the hood, so I'm not sure this change gets us anything.
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'm not sure about the nameBuilder change; do you mind giving the rationale for that?
Otherwise the fix looks good.
That was IDEA 'helping' |
Replaced string concatenation with a StringBuilder for constructing tech names in CampaignGUI. This improves code readability and performance, especially for complex string operations.
Should be good now. Glad you caught that. IDEA launched a new version and their file clean-up in previous versions was less aggressive. Disabled it moving forward. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #5355 +/- ##
============================================
- Coverage 10.47% 10.47% -0.01%
+ Complexity 6069 6066 -3
============================================
Files 959 959
Lines 135559 135598 +39
Branches 19750 19754 +4
============================================
- Hits 14204 14199 -5
- Misses 119997 120046 +49
+ Partials 1358 1353 -5 ☔ View full report in Codecov by Sentry. |
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.
LGTM!
Added logic to disable the Advance Day button to prevent multiple activations while the advance day event is still being resolved. Re-enabled the button after the process completes, ensuring proper functionality and avoiding unintended behavior.