Fix [TestQuotaExceededNoPro, TestQuotaExceededPro]

This commit is contained in:
2023-06-17 20:16:02 +02:00
parent d9a4c4ffd6
commit 7121afab08
3 changed files with 27 additions and 55 deletions

View File

@@ -115,7 +115,6 @@ func (db *Database) IncUserMessageCounter(ctx TxContext, user *models.User) erro
user.QuotaUsed = quota
user.QuotaUsedDay = langext.Ptr(scn.QuotaDayString())
user.TimestampLastSent = &now
_, err = tx.Exec(ctx, "UPDATE users SET timestamp_lastsent = :ts, messages_sent = messages_sent+1, quota_used = :qu, quota_used_day = :qd WHERE user_id = :uid", sq.PP{
"ts": time2DB(now),
@@ -127,6 +126,9 @@ func (db *Database) IncUserMessageCounter(ctx TxContext, user *models.User) erro
return err
}
user.TimestampLastSent = &now
user.MessagesSent = user.MessagesSent + 1
return nil
}