NebulousLabs / Sia-UI

A Graphical Frontend for Sia - https://sia.tech
MIT License
389 stars 109 forks source link

Negative funds remaining #727

Open nepeat opened 7 years ago

nepeat commented 7 years ago

Bug

When the sum of the spending totals are more than the allowance, the UI glitches and displays negative SC remaining.

Client/Server Info

Client is on macOS 10.13.0 GM, commit NebulousLabs/Sia-UI@d3aca71 Server is on Ubuntu Server 16.04 LTS, commit NebulousLabs/Sia@f16b5eb

Screenshots

App UI of the glitch Zoomed crop for mobile -4.639999999999986 SC remaining

lukechampine commented 7 years ago

Thanks for the detailed report! What's the desired behavior here? Seems like the amount spent shouldn't exceed the allowance in the first place, but I guess we shouldn't assume that will never happen. Maybe display 4.63 SC over allowance in red?

nepeat commented 7 years ago

I believe there is a bigger issue with the UI display in the first place since the info that it is giving is very different than what the CLI gives me.

I also was able to decrease my future allowance to 300 SC and well, the UI broke hard and couldn't display the allowance bar without rescaling the window.

Edit: Since GitHub sent my comment a little early, mind if I changed the bug title to "Allowance display problems when spending exceeds allowance"?

Renter info:
    Storage Spending:  118.3 SC
    Upload Spending:   3.697 SC
    Download Spending: 0 H
    Unspent Funds:     478.1 SC
    Total Allocated:   600.2 SC

Overflowing into menu icons

image

Contracts text cut off

image

Looks like it works, minus the SC remaining text

image

avahowell commented 7 years ago

Are you sure the UI is displaying different values than siac? They both pull from the renter's financialmetrics API endpoint, so they definitely should not be different. Thanks for the detailed report, there should be a pull request shortly to fix the sizing issues.

avahowell commented 7 years ago

Looks like the UI's unspent calculation was separate from the API. I was able to reproduce this issue, and #728 should resolve it.

nepeat commented 7 years ago

Just pulled the branch, bar width issue is fixed but the calculations still seem off. image

avahowell commented 7 years ago

What does the CLI give you?

nepeat commented 7 years ago

siac renter -v

Renter info:
    Storage Spending:  121 SC
    Upload Spending:   3.813 SC
    Download Spending: 0 H
    Unspent Funds:     475.4 SC
    Total Allocated:   600.2 SC

siac renter allowance

Allowance:
    Amount: 300 SC
    Period: 12096 blocks