Index: cgisetup/models/pgdb.scm ================================================================== --- cgisetup/models/pgdb.scm +++ cgisetup/models/pgdb.scm @@ -199,10 +199,15 @@ )) ttypes))) (define (pgdb:get-targets-of-type dbh ttype-id target-patt) (dbi:get-rows dbh "SELECT DISTINCT target FROM runs WHERE target LIKE ? AND ttype_id=?;" target-patt ttype-id)) + +(define (pgdb:get-runs-by-target dbh targets) + (dbi:get-rows dbh "SELECT r.run_name, t.test_name, t.status, t.item_path FROM runs as r INNER JOIN tests AS t ON t.run_id=r.id + WHERE t.state='COMPLETED' AND r.target like ?;" targets) +) ;;====================================================================== ;; V A R I O U S D A T A M A S S A G E R O U T I N E S ;;====================================================================== @@ -229,5 +234,19 @@ (hash-table-set! data first newht) (set! coldat newht))) (hash-table-set! coldat rest run))) runs) data)) + +(define (pgdb:runs-to-hash runs ) + (let* ((data (make-hash-table))) + (for-each + (lambda (run) + (let* ((run-name (vector-ref run 0)) + (test (conc (vector-ref run 1) ":" (vector-ref run 3))) + (coldat (hash-table-ref/default data run-name #f))) + (if (not coldat)(let ((newht (make-hash-table))) + (hash-table-set! data run-name newht) + (set! coldat newht))) + (hash-table-set! coldat test run))) + runs) + data)) Index: cgisetup/pages/home_view.scm ================================================================== --- cgisetup/pages/home_view.scm +++ cgisetup/pages/home_view.scm @@ -61,16 +61,19 @@ ;; ;; this silly trick preserves the checkmark ;; (if (member target-var row-or-col) 'checked "") ;; ""))) ;; all-parts)) )) + (s:br) + (s:p "  Result Format:   total / pass / fail / other") + (s:fieldset (conc "Runs data for " tfilter) ;; ;; A very basic display ;; - (let* ((a-keys (sort (hash-table-keys ordered-data) string>=?)) + (let* ((a-keys (sort (hash-table-keys ordered-data) string>=?)) (b-keys (delete-duplicates(sort (apply append (map (lambda (sub-key) (let ((subdat (hash-table-ref ordered-data sub-key))) (hash-table-keys subdat))) Index: cgisetup/pages/run_view.scm ================================================================== --- cgisetup/pages/run_view.scm +++ cgisetup/pages/run_view.scm @@ -9,12 +9,42 @@ ;; PURPOSE. ;;====================================================================== (define (pages:run session db shared) (let* ((dbh (s:db)) - (target (s:get-param 'target))) - + (target (string-substitute "_x_" "/" (s:get-param 'target) 'all)) + (runs (pgdb:get-runs-by-target dbh target)) + (ordered-runs (pgdb:runs-to-hash runs))) + (s:div 'class "col_12" (s:fieldset - "Show a run" - target)))) + (conc "Show a runs for Target: " target) + (let* ((a-keys (sort (hash-table-keys ordered-runs) string>=?)) + (b-keys (delete-duplicates(sort (apply + append + (map (lambda (sub-key) + (let ((subdat (hash-table-ref ordered-runs sub-key))) + (hash-table-keys subdat))) + a-keys)) + string>=?)))) + + (s:table + (s:tr (s:td "")(map s:td a-keys)) + (map + (lambda (row-key) + (s:tr (s:td row-key) + (map + (lambda (col-key) + (let ((val (let* ((ht (hash-table-ref/default ordered-runs col-key #f))) + (if ht (hash-table-ref/default ht row-key #f))))) + (if val + (let* ((result (vector-ref val 2)) + (bg (if (equal? result "PASS") + "green" + "red"))) + (s:td 'style (conc "background: " bg ) + (s:a 'href (s:link-to "log" 'target result) + result))) + (s:td "")))) + a-keys))) + b-keys)))))))