Index: dashboard.scm ================================================================== --- dashboard.scm +++ dashboard.scm @@ -83,10 +83,12 @@ (define *allruns* '()) (define *buttondat* (make-hash-table)) ;; (define *alltestnamelst* '()) (define *searchpatts* (make-hash-table)) (define *num-runs* 8) +(define *tot-run-count* (db:get-num-runs *db* "%")) +(define *last-update* (current-seconds)) (define *num-tests* 15) (define *start-run-offset* 0) (define *start-test-offset* 0) (define *examine-test-dat* (make-hash-table)) (define *exit-started* #f) @@ -179,10 +181,14 @@ (let* ((allruns (db-get-runs *db* runnamepatt numruns *start-run-offset*)) (header (db:get-header allruns)) (runs (db:get-rows allruns)) (result '()) (maxtests 0)) + (if (> (+ *last-update* 300) (current-seconds)) ;; every five minutes + (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)) (key-vals (get-key-vals *db* run-id))) (if (> (length tests) maxtests) @@ -403,14 +409,17 @@ (iup:button "<- Left" #:action (lambda (obj)(set! *start-run-offset* (+ *start-run-offset* 1)))) (iup:button "Up ^" #:action (lambda (obj)(set! *start-test-offset* (if (> *start-test-offset* 0)(- *start-test-offset* 1) 0)))) (iup:button "Down v" #:action (lambda (obj)(set! *start-test-offset* (if (>= *start-test-offset* (length *alltestnamelst*))(length *alltestnamelst*)(+ *start-test-offset* 1))))) (iup:button "Right ->" #:action (lambda (obj)(set! *start-run-offset* (if (> *start-run-offset* 0)(- *start-run-offset* 1) 0)))) (iup:valuator #:valuechanged_cb (lambda (obj) - (let ((val (iup:attribute obj "VALUE"))) - (set! *start-run-offset* (inexact->exact (round (string->number val)))) - (iup:attribute-set! obj "MAX" (length *allruns*)))) - #:expand "YES") + (let ((val (inexact->exact (round (string->number (iup:attribute obj "VALUE"))))) + (maxruns *tot-run-count*)) ;;; (+ *num-runs* (length *allruns*)))) + (set! *start-run-offset* val) + (debug:print 3 "maxruns: " maxruns ", val: " val) + (iup:attribute-set! obj "MAX" maxruns))) + #:expand "YES" + #:max (+ *num-runs* (length *allruns*))) ;(iup:button "inc rows" #:action (lambda (obj)(set! *num-tests* (+ *num-tests* 1)))) ;(iup:button "dec rows" #:action (lambda (obj)(set! *num-tests* (if (> *num-tests* 0)(- *num-tests* 1) 0)))) ) ) Index: db.scm ================================================================== --- db.scm +++ db.scm @@ -240,10 +240,21 @@ (number? (cadr count))) (conc " OFFSET " (cadr count)) "")) runpatt) (vector header res))) + +;; just get count of runs +(define (db:get-num-runs db runpatt) + (let ((numruns 0)) + (sqlite3:for-each-row + (lambda (count) + (set! numruns count)) + db + "SELECT COUNT(id) FROM runs WHERE runname LIKE ?;" runpatt) + numruns)) + ;; replace header and keystr with a call to runs:get-std-run-fields ;; keypatt: '(("key1" "patt1")("key2" "patt2")...) (define (db:get-runs db keys keypatts runpatt) (let* ((res '())