Merge branch 'master' into webshit_urls

This commit is contained in:
Chris Sexton 2019-08-08 10:15:52 -04:00 committed by GitHub
commit 729eb61dee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -293,6 +293,9 @@ func (w *Webshit) GetAllBalances() ([]Balance, error) {
// Bid allows a user to place a bid on a particular story // Bid allows a user to place a bid on a particular story
func (w *Webshit) Bid(user string, amount int, URL string) (Bid, error) { func (w *Webshit) Bid(user string, amount int, URL string) (Bid, error) {
bal := w.GetBalance(user) bal := w.GetBalance(user)
if amount < 0 {
return Bid{}, fmt.Errorf("cannot bid less than 0")
}
if bal < amount { if bal < amount {
return Bid{}, fmt.Errorf("cannot bid more than balance, %d", bal) return Bid{}, fmt.Errorf("cannot bid more than balance, %d", bal)
} }