Skip to content

Fix incorrect total offer quantity in profit calculation#62

Open
claudiodekker wants to merge 1 commit into
cbrewitt:mainfrom
claudiodekker:fix-inconsistent-profit-calculation
Open

Fix incorrect total offer quantity in profit calculation#62
claudiodekker wants to merge 1 commit into
cbrewitt:mainfrom
claudiodekker:fix-inconsistent-profit-calculation

Conversation

@claudiodekker

@claudiodekker claudiodekker commented Nov 18, 2025

Copy link
Copy Markdown
Contributor

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.

@cbrewitt

Copy link
Copy Markdown
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.

@claudiodekker

claudiodekker commented Nov 25, 2025

Copy link
Copy Markdown
Contributor Author

The problem with that, though, is that it's inconsistent with the quantity that's listed in the slot as well as the tooltip and what people might expect from the tooltip based on what the GE does by default. Especially if you didn't actually intend to flip 100% of the items.

Another example; These are the same item, that I bought on different days at different prices. I'm purposefully leaving one of them in here, as to not make a massive loss as I'm sure the price will rebound in a day or so. The second item however is a quick flip. There is no way I'm going to make anything remotely to a 3.5M profit there. It just doesn't make sense.

CleanShot 2025-12-11 at 21 32 47@2x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants