From 453bc5586917c7cf0e8fd20f6ed711b8f13db779 Mon Sep 17 00:00:00 2001 From: elraphty Date: Tue, 30 Jan 2024 19:03:17 +0100 Subject: [PATCH] updated next and previous buttons to remove deleted bounty --- db/db.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/db/db.go b/db/db.go index 28e6d3017..772ce7426 100644 --- a/db/db.go +++ b/db/db.go @@ -643,25 +643,25 @@ func (db database) GetBountyById(id string) ([]Bounty, error) { func (db database) GetNextBountyById(id string) ([]Bounty, error) { ms := []Bounty{} - err := db.db.Raw(`SELECT * FROM public.bounty WHERE id > '` + id + `' ORDER BY id ASC LIMIT 1`).Find(&ms).Error + err := db.db.Raw(`SELECT * FROM public.bounty WHERE id > '` + id + `' AND show = true ORDER BY id ASC LIMIT 1`).Find(&ms).Error return ms, err } func (db database) GetPreviousBountyById(id string) ([]Bounty, error) { ms := []Bounty{} - err := db.db.Raw(`SELECT * FROM public.bounty WHERE id < '` + id + `' ORDER BY id DESC LIMIT 1`).Find(&ms).Error + err := db.db.Raw(`SELECT * FROM public.bounty WHERE id < '` + id + `' AND show = true ORDER BY id DESC LIMIT 1`).Find(&ms).Error return ms, err } func (db database) GetNextOrganizationBountyById(uuid string, id string) ([]Bounty, error) { ms := []Bounty{} - err := db.db.Raw(`SELECT * FROM public.bounty WHERE org_uuid = '` + uuid + `' AND id > '` + id + `' ORDER BY id ASC LIMIT 1`).Find(&ms).Error + err := db.db.Raw(`SELECT * FROM public.bounty WHERE org_uuid = '` + uuid + `' AND id > '` + id + `' AND show = true ORDER BY id ASC LIMIT 1`).Find(&ms).Error return ms, err } func (db database) GetPreviousOrganizationBountyById(uuid string, id string) ([]Bounty, error) { ms := []Bounty{} - err := db.db.Raw(`SELECT * FROM public.bounty WHERE org_uuid = '` + uuid + `' AND id < '` + id + `' ORDER BY id DESC LIMIT 1`).Find(&ms).Error + err := db.db.Raw(`SELECT * FROM public.bounty WHERE org_uuid = '` + uuid + `' AND id < '` + id + `' AND show = true ORDER BY id DESC LIMIT 1`).Find(&ms).Error return ms, err }