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

Revert change to find parts by name when selling from parts in use #4665

Merged
merged 2 commits into from
Aug 18, 2024

Conversation

Algebro7
Copy link
Collaborator

Commit a4cc0f9 introduced a bug where several types of parts could no longer be sold. This PR simply reverts it and goes back to looking up the target part by name rather than ID.

I agree with the original comment that it's not ideal to search by strings, but it appears there isn't really a better way to do it with how this dialog is constructed. I think there are some opportunities for refactoring it but I think those should be done in the future rather than now. Let me know what you think.

Closes #4663

This reverts commit a4cc0f9 as it introduced a bug where several types of parts couldn't be sold.
@Algebro7 Algebro7 requested a review from IllianiCBT August 17, 2024 16:26
@codecov-commenter
Copy link

codecov-commenter commented Aug 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 10.67%. Comparing base (de23745) to head (af9b0f4).
Report is 24 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #4665      +/-   ##
============================================
+ Coverage     10.23%   10.67%   +0.44%     
- Complexity     5706     5707       +1     
============================================
  Files           950      950              
  Lines        131272   131271       -1     
  Branches      19135    19131       -4     
============================================
+ Hits          13434    14014     +580     
+ Misses       116614   116034     -580     
+ Partials       1224     1223       -1     

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

Copy link
Member

@NickAragua NickAragua left a comment

Choose a reason for hiding this comment

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

Flagging for some extra testing due to backwards compatibility requirements.

@@ -35,13 +35,14 @@ public PartInUse(Part part) {
appendDetails(sb, part);
}
part.setUnit(u);
this.id = part.getId();
this.name = part.getName();
Copy link
Member

Choose a reason for hiding this comment

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

How does this play with loading files from the previous version?

Copy link
Collaborator Author

@Algebro7 Algebro7 Aug 18, 2024

Choose a reason for hiding this comment

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

So the PartInUse is not actually stored in save files, at least in this context it's just a (lossy) model constructed for this dialog. When opening this dialog it loops through the warehouse and constructs PartInUse objects from them to provide this overview. It didn't look like they were saved after the dialog is closed but I will double check that when I'm back at a computer

Copy link
Member

Choose a reason for hiding this comment

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

Ok. If PartInUse isn't being saved, then we can consider this good to go.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Alright yeah, I just double checked and it's not saved anywhere. The only part that is persistent is the IAcquisitionWork partToBuy field, which is pulled from the Part this is being constructed from and saved to the shopping list when buying items, but neither PR touched that object. So we should be good.

@IllianiCBT IllianiCBT merged commit 150314c into MegaMek:master Aug 18, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[v0.50.0-SNAPSHOT] Unable to sell most parts through the Parts In Use Report.
5 participants