Move ordering from views to queries.ts
Turns out views aren't guaranteed to keep their order ¯\_(ツ)_/¯ Fixes #24
This commit is contained in:
parent
354eddb673
commit
4607eaf307
2 changed files with 9 additions and 9 deletions
|
@ -57,24 +57,26 @@ export const getRequests = {
|
|||
name: "getRequests",
|
||||
text: "SELECT * FROM requests_vw \
|
||||
JOIN states ON requests_vw.state = states.state \
|
||||
WHERE active LIMIT $1"
|
||||
WHERE active ORDER BY score DESC, reqTimestamp ASC LIMIT $1"
|
||||
}
|
||||
|
||||
export const getRequestsVoted = {
|
||||
name: "getRequestsVoted",
|
||||
text: "SELECT * FROM get_requests_voted($2) \
|
||||
JOIN states ON get_requests_voted.state = states.state \
|
||||
WHERE active LIMIT $1"
|
||||
WHERE active ORDER BY score DESC, reqTimestamp ASC LIMIT $1"
|
||||
}
|
||||
|
||||
export const getAllRequests = {
|
||||
name: "getAllRequests",
|
||||
text: "SELECT * FROM requests_vw LIMIT $1"
|
||||
text: "SELECT * FROM requests_vw \
|
||||
ORDER BY score DESC, reqTimestamp ASC LIMIT $1"
|
||||
}
|
||||
|
||||
export const getAllRequestsVoted = {
|
||||
name: "getAllRequestsVoted",
|
||||
text: "SELECT * FROM get_requests_voted($2) LIMIT $1"
|
||||
text: "SELECT * FROM get_requests_voted($2) \
|
||||
ORDER BY score DESC, reqTimestamp ASC LIMIT $1"
|
||||
}
|
||||
|
||||
export const checkRequestExists = {
|
||||
|
@ -137,7 +139,7 @@ export const getAndLockCronJob = {
|
|||
text: `SELECT * FROM cron
|
||||
WHERE (lastSuccess + runInterval) < now()
|
||||
AND jobName = $1
|
||||
FOR UPDATE SKIP LOCKED;`
|
||||
FOR UPDATE SKIP LOCKED`
|
||||
}
|
||||
|
||||
export const updateCronJobLastSuccess = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue