Index: dashboard.scm ================================================================== --- dashboard.scm +++ dashboard.scm @@ -215,19 +215,20 @@ (begin (set! *last-update* (current-seconds)) (set! *tot-run-count* (db:get-num-runs *db* runnamepatt)))) (for-each (lambda (run) (let* ((run-id (db:get-value-by-header run header "id")) - (tests (db-get-tests-for-run *db* run-id testnamepatt itemnamepatt states statuses)) + (tests (let ((tsts (db-get-tests-for-run *db* run-id testnamepatt itemnamepatt states statuses))) + (if *tests-sort-reverse* (reverse tsts) tsts))) (key-vals (get-key-vals *db* run-id))) (if (> (length tests) maxtests) (set! maxtests (length tests))) ;(if (not (null? tests)) (set! result (cons (vector run tests key-vals) result)))); ) runs) (set! *header* header) - (set! *allruns* (if *tests-sort-reverse* (reverse result) result)) + (set! *allruns* result) (debug:print 6 "*allruns* has " (length *allruns*) " runs") ;; (set! *tot-run-count* (+ 1 (length *allruns*))) maxtests)) *num-tests*))) ;; FIXME, naughty coding eh? @@ -471,12 +472,14 @@ #:action (lambda (obj unk val) (set! *last-db-update-time* 0) (update-search "item-name" val))))) (iup:vbox (iup:hbox - (iup:button "Sort" #:acton (lambda (obj) - (set! *tests-sort-order* (not *tests-sort-order*))))) + (iup:button "Sort" #:action (lambda (obj) + (set! *tests-sort-reverse* (not *tests-sort-reverse*)) + (iup:attribute-set! obj "TITLE" (if *tests-sort-reverse* "+Sort" "-Sort")) + (set! *last-db-update-time* 0)))) (iup:hbox (iup:button "Quit" #:action (lambda (obj)(sqlite3:finalize! *db*)(exit))) (iup:button "Monitor" #:action (lambda (obj)(system (conc (car (argv))" -guimonitor &"))))) )) ;; (iup:button "<- Left" #:action (lambda (obj)(set! *start-run-offset* (+ *start-run-offset* 1)))) Index: db.scm ================================================================== --- db.scm +++ db.scm @@ -368,11 +368,13 @@ (set! res (cons (vector id run-id testname state status event-time host cpuload diskfree uname rundir item-path run-duration final-logf comment) res))) db (conc "SELECT id,run_id,testname,state,status,event_time,host,cpuload,diskfree,uname,rundir,item_path,run_duration,final_logf,comment " " FROM tests WHERE run_id=? AND testname like ? AND item_path LIKE ? " " AND NOT (state in " states-str " AND status IN " statuses-str ") " - " ORDER BY id DESC;") + ;; " ORDER BY id DESC;" + " ORDER BY event_time ASC;" ;; POTENTIAL ISSUE! CHECK ME! Does anyting depend on this being sorted by id? + ) run-id (if testpatt testpatt "%") (if itempatt itempatt "%")) res))