-
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
Second attempt: Sell Parts from Parts in Use Dialog #4792
Second attempt: Sell Parts from Parts in Use Dialog #4792
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #4792 +/- ##
============================================
- Coverage 10.76% 10.76% -0.01%
+ Complexity 5668 5667 -1
============================================
Files 948 948
Lines 132553 132569 +16
Branches 19048 19052 +4
============================================
- Hits 14272 14269 -3
- Misses 117041 117061 +20
+ Partials 1240 1239 -1 ☔ 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.
Marking this as approved, despite a minor bit of feedback. Overall the code is clean and looks functional. I would definitely want this in the hands of QA so they can vigorously test it, so once it’s merged please flag it in the QA channel and ask them to break it. With this being such a high demand function, I wanna make sure it hits release in a 10/10 state, if that makes sense.
80ef8ce
to
0dd549a
Compare
This has caught some conflicts following the recent name changes. |
# Conflicts: # MekHQ/src/mekhq/campaign/parts/PartInUse.java # MekHQ/src/mekhq/gui/dialog/PartsReportDialog.java
0dd549a
to
51714d2
Compare
This PR re-implements selling parts from the parts in use dialog in a (hopefully) much more robust way. Rather than storing strings representing the name and looking up the parts in the warehouse, which was incredibly unreliable due to inconsistent naming under the hood, references to the legit spare part objects are stored in the PartInUse row when building out the table. These objects are rebuilt everytime the table refreshes or is re-opened so there should be no concern about the extra persistent state.
I also added a
getSellableQuantity()
method to thePart
class, primarily to be overridden byAmmoStorage
andArmor
, which track their quantities different than all other parts. This allows the caller to not have to explicitly check the type of the Part being sold.Closes #4723