Skip to content

Commit

Permalink
changed order to created
Browse files Browse the repository at this point in the history
  • Loading branch information
elraphty committed Feb 6, 2024
1 parent cfa620b commit e72bd58
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
11 changes: 5 additions & 6 deletions db/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion db/structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit e72bd58

Please sign in to comment.