[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Tatiana |
Date: |
Sun, 8 Jul 2018 12:37:49 -0400 (EDT) |
branch: web-interface
commit 643f25f265102652df463b580ba981b82baac076
Author: TSholokhova <address@hidden>
Date: Sun Jul 8 18:37:22 2018 +0200
Update id pagination (previous+last buttons).
* src/cuirass/templates.scm: Add buttons for pagination.
* src/cuirass/database.scm(db-get-evaluations-build-summary): Implement
different order for low and high borders.
---
src/cuirass/database.scm | 5 +++--
src/cuirass/templates.scm | 18 +++++++++---------
2 files changed, 12 insertions(+), 11 deletions(-)
diff --git a/src/cuirass/database.scm b/src/cuirass/database.scm
index 30dc706..b3d43fc 100644
--- a/src/cuirass/database.scm
+++ b/src/cuirass/database.scm
@@ -575,9 +575,10 @@ FROM Evaluations ORDER BY id DESC LIMIT " limit ";"))
WHERE (specification=" spec ")\
AND (" border-low "IS NULL OR (id >" border-low "))\
AND (" border-high "IS NULL OR (id <" border-high "))\
- ORDER BY id DESC
+ ORDER BY CASE WHEN " border-low "IS NULL THEN id ELSE -id END DESC
LIMIT " limit ") E
-ON B.evaluation=E.id;"))
+ON B.evaluation=E.id
+ORDER BY E.id ASC;"))
(evaluations '()))
(match rows
(() evaluations)
diff --git a/src/cuirass/templates.scm b/src/cuirass/templates.scm
index c134ec3..6e4d7bd 100644
--- a/src/cuirass/templates.scm
+++ b/src/cuirass/templates.scm
@@ -77,20 +77,20 @@
(ul (@ (class "pagination"))
(li (@ (class "page-item"))
(a (@ (class "page-link")
- (href "?border-low=" ,(number->string (- id-min 1))))
+ (href "?border-high=" ,(number->string (+ id-max 1))))
"<< First"))
- ;(li (@ (class "page-item" ,(if (= page-id-max id-max) " disabled"
"")))
- ; (a (@ (class "page-link")
- ; (href "?border-low=" ,(number->string page-id-max)))
- ; "< Previous"))
+ (li (@ (class "page-item" ,(if (= page-id-max id-max) " disabled"
"")))
+ (a (@ (class "page-link")
+ (href "?border-low=" ,(number->string page-id-max)))
+ "< Previous"))
(li (@ (class "page-item" ,(if (= page-id-min id-min) " disabled"
"")))
(a (@ (class "page-link")
(href "?border-high=" ,(number->string page-id-min)))
"Next >"))
- ;(li (@ (class "page-item"))
- ; (a (@ (class "page-link")
- ; (href "?border-high=" ,(number->string (+ id-min
PAGESIZE))))
- ; "Last >>"))
+ (li (@ (class "page-item"))
+ (a (@ (class "page-link")
+ (href "?border-low=" ,(number->string (- id-min 1))))
+ "Last >>"))
))))