Fix incorrect total offer quantity in profit calculation#62
Open
claudiodekker wants to merge 1 commit into
Open
Fix incorrect total offer quantity in profit calculation#62claudiodekker wants to merge 1 commit into
claudiodekker wants to merge 1 commit into
Conversation
Owner
|
The profit in the tooltip is intended to show the potential profit for the entire offer, not just the quantity remaining. I believe the issue in the linked discord post relates to a separate issue. |
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Fixes https://discord.com/channels/1208453764630057010/1440277923260137545
Profit calculations were incorrectly using the total offer quantity instead of the remaining unsold quantity, causing profit/loss values to be doubled (or incorrect).
Root Cause: In TooltipController.java line 115, the profit calculation was using offer.getTotalQuantity() which represents the entire offer size (e.g., 16 rings) instead of just the remaining unsold items (e.g., 8 rings if 8 were already sold).
Solution: Changed the calculation to use remainingQuantity = offer.getTotalQuantity() - offer.getQuantitySold() to ensure profit is only calculated for items that haven't been sold yet.
This fix ensures the tooltip profit display correctly reflects only the profit from items currently available to sell, not the entire historical offer size. This matches the logic already used in FlipV2.calculateProfit() which correctly uses openedQuantity - closedQuantity.