menu-voucherlist #101

Merged
lash merged 63 commits from menu-voucherlist into master 2024-10-25 15:59:47 +02:00
Showing only changes of commit 4011597d9c - Show all commits

View File

@ -640,10 +640,14 @@ 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
Outdated
Review

If no active sym then the user has no vouchers yet, and then no balance should be displayed, I think?

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

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
if db.IsNotFound(err) {
lash marked this conversation as resolved Outdated
Outdated
Review

Why should it be 0.00 when error?

Why should it be 0.00 when 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

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
res.Content = "0.00" res.Content = "0.00"
return res, nil 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)
if err != nil { if err != nil {
return res, nil return res, nil