frontend-monorepo
frontend-monorepo copied to clipboard
Estimated reward bug in game details
The Chore
Couple of bugs
Issue 1: Lottery estimated rewards
For lottery reward type we cannot attept to estimate the reward so we shouldnt try
- [x] Show ? or "Lottery" or show the dice icon on each row would be nice
Issue 2: Estimated rewards going negative
We are seeing negative values for estimated rewards as seen in screenshot. It is possible to have a negative live score (in fact in PNL game it is inevitable) and it looks like in these cases when in a pro rata game we're falling over. In some cases where overal gains <> overall losses we generate a negative estimated reward, and in the worst case where game participants have only traded with each other overall gains = overall losses eg. [-20, -10, 10, 20] which means when trying to get the pro rata reward we'll end up dividing by zero and nuking the page which is currently the case here.
- [ ] Before trying to generate the pro rata expected score, first offset all scores by the LOWEST score at that time to ensure all are positive, ie. If scores were [-20, -10, 10, 20] these become [0, 10, 30, 40] and then [0/80, 10/80, 30/80, 40/80] is the share of the rewards (see spec extract below for further details)