menu-voucherlist #101
@ -640,8 +640,12 @@ func (h *Handlers) CheckBalance(ctx context.Context, sym string, input []byte) (
|
|||||||
// get the active sym and active balance
|
// get the active sym and active balance
|
||||||
activeSym, err := store.ReadEntry(ctx, sessionId, utils.DATA_ACTIVE_SYM)
|
activeSym, err := store.ReadEntry(ctx, sessionId, utils.DATA_ACTIVE_SYM)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
Alfred-mk marked this conversation as resolved
Outdated
|
|||||||
res.Content = "0.00"
|
if db.IsNotFound(err) {
|
||||||
lash marked this conversation as resolved
Outdated
lash
commented
Why should it be 0.00 when error? Why should it be 0.00 when error?
Alfred-mk
commented
The 0.00 is a placeholder. I set it like this without a symbol since the error indicates no symbol exists. I have updated this to check the specific db error The 0.00 is a placeholder. I set it like this without a symbol since the error indicates no symbol exists.
I have updated this to check the specific db error
|
|||||||
return res, nil
|
res.Content = "0.00"
|
||||||
|
return res, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
return res, err
|
||||||
}
|
}
|
||||||
|
|
||||||
activeBal, err := store.ReadEntry(ctx, sessionId, utils.DATA_ACTIVE_BAL)
|
activeBal, err := store.ReadEntry(ctx, sessionId, utils.DATA_ACTIVE_BAL)
|
||||||
|
Loading…
Reference in New Issue
Block a user
If no active sym then the user has no vouchers yet, and then no balance should be displayed, I think?
For this, I've added a function that sets the default voucher, (expecting it to be SRF) if no active voucher is set for the user.
This will be loaded on the main.vis, ensuring that one has the default sym if they haven't set their own