Index: dashboard.scm ================================================================== --- dashboard.scm +++ dashboard.scm @@ -142,13 +142,17 @@ (define *db-file-path* (conc *toppath* "/megatest.db")) (define *tests-sort-options* (vector (vector "Sort +a" 'testname "ASC") (vector "Sort -a" 'testname "DESC") (vector "Sort +t" 'event_time "ASC") - (vector "Sort -t" 'event_time "DESC"))) + (vector "Sort -t" 'event_time "DESC") + (vector "Sort +s" 'statestatus "ASC") + (vector "Sort -s" 'statestatus "DESC"))) + +;; Don't forget to adjust the >= below if you add to the sort-options above (define (next-sort-option) - (if (>= *tests-sort-reverse* 3) + (if (>= *tests-sort-reverse* 5) (set! *tests-sort-reverse* 0) (set! *tests-sort-reverse* (+ *tests-sort-reverse* 1))) *tests-sort-reverse*) (define *tests-sort-reverse* 0) @@ -312,11 +316,11 @@ (loop (+ i 1))))))) ;; Bubble up the top tests to above the items, collect the items underneath ;; all while preserving the sort order from the SQL query as best as possible. ;; -(define (bubble-up test-dats) +(define (bubble-up test-dats #!key (priority 'itempath)) (if (null? test-dats) test-dats (begin (let* ((tnames '()) ;; list of names used to reserve order (tests (make-hash-table))) ;; hash of lists, used to build as we go @@ -323,11 +327,17 @@ (for-each (lambda (testdat) (let* ((tname (db:test-get-testname testdat)) (ipath (db:test-get-item-path testdat)) (seen (hash-table-ref/default tests tname #f))) - (if (not seen)(set! tnames (append tnames (list tname)))) + (if (not seen) + (set! tnames (append tnames (list tname)))) +;; (if (or (and (eq? priority 'itempath) +;; (not (equal? ipath ""))) +;; (and (eq? priority 'testname) +;; (equal? ipath ""))) +;; (set! tnames (append tnames (list tname))))) (if (equal? ipath "") ;; This a top level, prepend it (hash-table-set! tests tname (cons testdat (hash-table-ref/default tests tname '()))) ;; This is item, append it (hash-table-set! tests tname (append (hash-table-ref/default tests tname '())(list testdat)))))) Index: db.scm ================================================================== --- db.scm +++ db.scm @@ -943,16 +943,17 @@ (qry (conc "SELECT " qryvals " FROM tests WHERE run_id=? AND state != 'DELETED' " states-statuses-qry (if tests-match-qry (conc " AND (" tests-match-qry ") ") "") (case sort-by - ((rundir) " ORDER BY length(rundir) ") - ((testname) " ORDER BY testname,item_path ") - ((event_time) " ORDER BY event_time ") - (else (if (string? sort-by) - (conc " ORDER BY " sort-by) - ""))) + ((rundir) " ORDER BY length(rundir) ") + ((testname) " ORDER BY testname,item_path ") + ((statestatus) " ORDER BY state,status ") + ((event_time) " ORDER BY event_time ") + (else (if (string? sort-by) + (conc " ORDER BY " sort-by) + ""))) (if sort-order sort-order "") (if limit (conc " LIMIT " limit) "") (if offset (conc " OFFSET " offset) "") ";" )))