Skip to content

Commit

Permalink
hide expired db entries from the db page, as they are practically con…
Browse files Browse the repository at this point in the history
…sidered to be deleted (#1779)

Co-authored-by: Ashish <[email protected]>
  • Loading branch information
ashishjh-bst and ashishjh-bst authored Nov 30, 2024
1 parent 5d56475 commit 7fa8aa7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions customcommands/customcommands.go
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ func getDatabaseEntries(ctx context.Context, guildID int64, page int, queryType,
qms = append(qms, qm.Where("key ILIKE ?", query))
}
}

qms = append(qms, qm.Where("(expires_at IS NULL or expires_at > now())"))
count, err := models.TemplatesUserDatabases(qms...).CountG(ctx)
if int64(page) > (count / 100) {
page = int(math.Ceil(float64(count) / 100))
Expand All @@ -441,7 +441,7 @@ func convertEntries(result models.TemplatesUserDatabaseSlice) []*LightDBEntry {
b, err := json.Marshal(converted.Value)
if err != nil {
logger.WithError(err).Warn("[cc/web] failed converting to light db entry")
continue
b = []byte("Failed to convert db entry to a readable format")
}

converted.Value = common.CutStringShort(string(b), dbPageMaxDisplayLength)
Expand Down

0 comments on commit 7fa8aa7

Please sign in to comment.