commit 4a0c3db6251f39b8ec3f5feaf91d1dcd6a0e5e9f parent 5a645bbf9847e658d521af74ce952ebfc6b9d733 Author: n0tr1v <n0tr1v@protonmail.com> Date: Fri, 15 Dec 2023 02:49:11 -0500 simplify code Diffstat:
| M | pkg/web/handlers/handlers.go | | | 4 | ++-- |
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pkg/web/handlers/handlers.go b/pkg/web/handlers/handlers.go @@ -864,8 +864,8 @@ func PokerHomeHandler(c echo.Context) error { } lastOutTransaction, _ := db.GetLastUserWithdrawPokerXmrTransaction(authUser.ID) - if lastOutTransaction.CreatedAt.After(time.Now().Add(-5 * time.Minute)) { - diff := (5 * time.Minute) - time.Now().Sub(lastOutTransaction.CreatedAt) + if time.Since(lastOutTransaction.CreatedAt) < 5*time.Minute { + diff := time.Until(lastOutTransaction.CreatedAt.Add(5 * time.Minute)) data.Error = fmt.Sprintf("Wait %s before doing a new withdraw transaction", utils.ShortDur(diff)) return c.Render(http.StatusOK, "poker", data) }