-
Notifications
You must be signed in to change notification settings - Fork 198
Leases! #7043
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
base: main
Are you sure you want to change the base?
Leases! #7043
Conversation
…ore consistent behavior.
…n in shopping list left to do.
…n in shopping list left to do.
…priately and add leased units to your hanger.
…priately and add leased units to your hanger.
…c from Lease logic.
…n in shopping list left to do.
…priately and add leased units to your hanger.
…priately and add leased units to your hanger.
…c from Lease logic.
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.
Pull Request Overview
This PR adds leasing support for large craft (dropships and jumpships), integrating lease creation in the UI and handling monthly lease payments in the campaign’s finance system.
- Introduces
LeaseandLeaseOrderto represent and serialize leases. - Adds UI controls for leasing in
UnitViewPaneland the unit selector dialog, plus cancel-lease in the right-click menu. - Updates
Finances,Accountant, andQuartermasterto charge, record, and cancel lease payments, and adds the campaign option to track leases.
Reviewed Changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| gui/view/UnitViewPanel.java | Show monthly lease cost when a unit has an active lease |
| gui/dialog/MekHQUnitSelectorDialog.java | Add Lease/LeaseGM buttons and handler |
| gui/campaignOptions/contents/FinancesTab.java | Add “Track Leases” checkbox in Finance options tab |
| gui/adapter/UnitTableMouseAdapter.java | Add “Cancel Lease” popup-menu command |
| campaign/finances/Lease.java & LeaseOrder.java | Implement lease cost calculations and XML I/O |
| campaign/Quartermaster.java | Provide leaseUnit and cancelUnitLease operations |
| campaign/finances/Finances.java & Accountant.java | Charge monthly lease payments during finance cycle |
| campaign/CampaignOptions.java | Add trackLeases option with XML persistence |
| resources/*.properties | Add localization strings for lease transactions |
Comments suppressed due to low confidence (1)
MekHQ/src/mekhq/gui/dialog/MekHQUnitSelectorDialog.java:113
- If
selectedUnitis null, this call can NPE. It would be safer to checkselectedUnitbefore dereferencing or use the already-checkedgetSelectedEntity().
Entity entity = selectedUnit.getEntity();
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #7043 +/- ##
=======================================
Coverage ? 12.49%
Complexity ? 7390
=======================================
Files ? 1140
Lines ? 146648
Branches ? 22489
=======================================
Hits ? 18328
Misses ? 126435
Partials ? 1885 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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 have not finished reviewing, but there are lots of stuff to fix, others to change, and alot of redundancy you add.
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.
So I know this is still WIP but I thought I'd take a nosey around. I'm going to leave quite a bit of feedback, some minor some not so minor. I am fully onboard with this feature, but we need to be making sure we're doing it right.
…rder as well, XML cleanup in ShoppingList, and marking nullable functions as nullable
# Conflicts: # MekHQ/src/mekhq/campaign/CampaignOptions.java # MekHQ/src/mekhq/campaign/finances/Finances.java # MekHQ/src/mekhq/campaign/unit/Unit.java # MekHQ/src/mekhq/campaign/unit/UnitOrder.java # MekHQ/src/mekhq/gui/adapter/ProcurementTableMouseAdapter.java # MekHQ/src/mekhq/gui/adapter/UnitTableMouseAdapter.java # MekHQ/src/mekhq/gui/dialog/MekHQUnitSelectorDialog.java # MekHQ/src/mekhq/gui/view/UnitViewPanel.java
| //Act | ||
| Money testCost = mockUnit.getUnitLease().getLeaseCost(); | ||
|
|
||
| //Assert | ||
| assertEquals(Money.of(3000), testCost); | ||
| } | ||
|
|
||
| @Test | ||
| void getLeaseCostNow_WhenFullMonthCost_CalculatesBaseLeaseCostCorrectly() { | ||
| //Arrange | ||
| LocalDate testDate = LocalDate.parse("3025-05-01"); | ||
|
|
||
| //Act | ||
| Money testCost = mockUnit.getUnitLease().getLeaseCostNow(testDate); | ||
|
|
||
| //Assert | ||
| assertEquals(Money.of(3000), testCost); |
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.
remove the comments
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 think the comments are fine. They're helpful in making tests clearer and also encouraging developers to write well constructed tests.
…lls properly if you have leased units and disable new lease acquisitions
|
This has been in development for a while and I don't want it to die on the vine. What still needs to be done to bring it across the finish line? :) |
Needs heavy review. Would like assistance writing units tests for (at least some) parts of it.
Design document can be found here: https://tinyurl.com/4erz5r9y