From e72bd58557e137b3e72510da1a03183500a9d9b2 Mon Sep 17 00:00:00 2001 From: elraphty Date: Tue, 6 Feb 2024 13:23:33 +0100 Subject: [PATCH] changed order to created --- db/db.go | 11 +++++------ db/structs.go | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/db/db.go b/db/db.go index 22b5547ba..a71466fae 100644 --- a/db/db.go +++ b/db/db.go @@ -764,8 +764,8 @@ func (db database) GetNextBountyByCreated(r *http.Request) ([]Bounty, error) { } } - query := `SELECT * FROM public.bounty WHERE id > '` + created + `' AND show = true` - orderQuery := "ORDER BY id ASC LIMIT 1" + query := `SELECT * FROM public.bounty WHERE created > '` + created + `' AND show = true` + orderQuery := "ORDER BY created ASC LIMIT 1" allQuery := query + " " + searchQuery + " " + statusQuery + " " + languageQuery + " " + orderQuery @@ -825,8 +825,8 @@ func (db database) GetPreviousBountyByCreated(r *http.Request) ([]Bounty, error) } } - query := `SELECT * FROM public.bounty WHERE id < '` + created + `' AND show = true` - orderQuery := "ORDER BY id DESC LIMIT 1" + query := `SELECT * FROM public.bounty WHERE created < '` + created + `' AND show = true` + orderQuery := "ORDER BY created DESC LIMIT 1" allQuery := query + " " + searchQuery + " " + statusQuery + " " + languageQuery + " " + orderQuery @@ -887,9 +887,8 @@ func (db database) GetNextOrganizationBountyByCreated(r *http.Request) ([]Bounty } } - fmt.Println("Org UUID", uuid) query := `SELECT * FROM public.bounty WHERE org_uuid = '` + uuid + `' AND created > '` + created + `' AND show = true` - orderQuery := "ORDER BY id ASC LIMIT 1" + orderQuery := "ORDER BY created ASC LIMIT 1" allQuery := query + " " + searchQuery + " " + statusQuery + " " + languageQuery + " " + orderQuery diff --git a/db/structs.go b/db/structs.go index 03c882e15..479548717 100644 --- a/db/structs.go +++ b/db/structs.go @@ -116,9 +116,9 @@ type Person struct { PriceToMeet int64 `json:"price_to_meet"` NewTicketTime int64 `json:"new_ticket_time", gorm: "-:all"` TwitterConfirmed bool `json:"twitter_confirmed"` + ReferredBy uint `json:"referred_by"` Extras PropertyMap `json:"extras", type: jsonb not null default '{}'::jsonb` GithubIssues PropertyMap `json:"github_issues", type: jsonb not null default '{}'::jsonb` - ReferredBy uint `json:"referred_by"` } type GormDataTypeInterface interface {