Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Guix Cuirass
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to JiHu GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Panda
Guix Cuirass
Commits
38f48c80
Unverified
Commit
38f48c80
authored
4 years ago
by
Mathieu Othacehe
Browse files
Options
Downloads
Patches
Plain Diff
database: Fix builds pagination.
* src/cuirass/database.scm (db-get-builds): Fix pagination.
parent
e35eee6a
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/cuirass/database.scm
+23
-14
23 additions, 14 deletions
src/cuirass/database.scm
with
23 additions
and
14 deletions
src/cuirass/database.scm
+
23
−
14
View file @
38f48c80
...
...
@@ -927,15 +927,22 @@ FILTERS is an assoc list whose possible keys are 'derivation | 'id | 'jobset |
;; XXX: Make sure that all filters are covered by an index.
(
define
(
filters->order
filters
)
(
match
(
assq
'order
filters
)
((
'order
.
'build-id
)
"Builds.rowid ASC"
)
((
'order
.
'finish-time
)
"stoptime DESC"
)
((
'order
.
'finish-time+build-id
)
"stoptime DESC, Builds.rowid DESC"
)
;; With this order, builds in 'running' state (-1) appear
;; before those in 'scheduled' state (-2).
((
'order
.
'status+submission-time
)
"Builds.status DESC, Builds.timestamp DESC, Builds.rowid ASC"
)
(
_
"Builds.rowid DESC"
)))
(
lambda
(
inner
)
(
match
(
assq
'order
filters
)
((
'order
.
'build-id
)
"Builds.rowid ASC"
)
((
'order
.
'finish-time
)
"stoptime DESC"
)
((
'order
.
'finish-time+build-id
)
(
if
inner
"CASE WHEN :borderlowid IS NULL THEN
stoptime ELSE -stoptime END DESC,
CASE WHEN :borderlowid IS NULL THEN
Builds.rowid ELSE -Builds.rowid END DESC"
"stoptime DESC, Builds.rowid DESC"
))
;; With this order, builds in 'running' state (-1) appear
;; before those in 'scheduled' state (-2).
((
'order
.
'status+submission-time
)
"Builds.status DESC, Builds.timestamp DESC, Builds.rowid ASC"
)
(
_
"Builds.rowid DESC"
))))
;; XXX: Make sure that all filters are covered by an index.
(
define
(
where-conditions
filters
)
...
...
@@ -953,10 +960,12 @@ FILTERS is an assoc list whose possible keys are 'derivation | 'id | 'jobset |
(
'pending
"Builds.status < 0"
)
(
'succeeded
"Builds.status = 0"
)
(
'failed
"Builds.status > 0"
)))
(
border-low-time
.
"Builds.stoptime > :borderlowtime"
)
(
border-high-time
.
"Builds.stoptime < :borderhightime"
)
(
border-low-id
.
"Builds.id > :borderlowid"
)
(
border-high-id
.
"Builds.id < :borderhighid"
)))
(
border-low-time
.
"(:borderlowtime IS NULL OR :borderlowid IS NULL OR
((:borderlowtime, :borderlowid) < (Builds.stoptime, Builds.rowid)))"
)
(
border-high-time
.
"(:borderhightime IS NULL OR :borderhighid IS NULL OR
((:borderhightime, :borderhighid) > (Builds.stoptime, Builds.rowid)))"
)))
(
filter
string?
...
...
@@ -1022,7 +1031,7 @@ INNER JOIN Outputs ON Outputs.derivation = Builds.derivation
LEFT JOIN BuildProducts as BP ON BP.build = Builds.rowid
GROUP BY Builds.derivation
ORDER BY ~a;"
where
order
order
))
where
(
order
#t
)
(
order
#f
)
))
(
stmt
(
sqlite-prepare
db
stmt-text
#
:cache?
#t
)))
(
sqlite-bind
stmt
'nr
(
match
(
assq-ref
filters
'nr
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment