8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
;; implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
;; PURPOSE.
;;======================================================================
(define (pages:home session db shared)
(let* ((dbh (s:db))
(ttypes (pgdb:get-target-types dbh))
(selected (string->number (or (s:get "target-type") "0")))
(curr-trec (filter (lambda (x)(eq? selected (vector-ref x 0))) ttypes))
(curr-ttype (if (and selected
(not (null? curr-trec)))
(vector-ref (car curr-trec) 1) #f))
(all-parts (if curr-ttype (append (string-split curr-ttype "/") '("runname" "testname")) '()))
(tfilter (or (s:get "target-filter") "%"))
(targets (pgdb:get-targets-of-type dbh selected tfilter))
;; (target (s:session-var-get "target"))
;; (target-patt (or target "%"))
(row-or-col (string-split (or (s:get "row-or-col") "") ","))
(all-data (if selected (pgdb:get-stats-given-target dbh selected tfilter)
'()))
;; (all-data (pgdb:get-tests dbh tfilter))
(ordered-data (pgdb:coalesce-runs dbh all-data all-parts row-or-col 0)))
(s:div 'class "col_12"
(s:fieldset
"Area type and target filter"
(s:form
'action "home.filter" 'method "get"
(s:div 'class "col_12"
(s:div 'class "col_6"
(s:select (map (lambda (x)
(let ((tt-id (vector-ref x 0))
(ttype (vector-ref x 1)))
(if (eq? tt-id selected)
(list ttype tt-id ttype #t)
(list ttype tt-id ttype #f))))
ttypes)
'name 'target-type))
(s:div 'class "col_4"
(s:input-preserve 'name "tfilter" 'placeholder "Filter targets"))
(s:div 'class "col_2"
(s:input 'type "submit" 'name "set-filter-vals" 'value "Submit")))
;; use radio buttons to select whether to put this identifier in row or column.
;; this seems clumsly and takes up a lot of screen realestate
|
|
>
>
>
|
|
|
>
|
|
|
|
|
>
|
|
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
;; implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
;; PURPOSE.
;;======================================================================
(define (pages:home session db shared)
(let* ((dbh (s:db))
(ttypes (pgdb:get-target-types dbh))
(selected (string->number (or (s:get "target-type") "-1")))
(curr-trec (filter (lambda (x)(eq? selected (vector-ref x 0))) ttypes))
(curr-ttype (if (and selected
(not (null? curr-trec)))
(vector-ref (car curr-trec) 1) #f))
(all-parts (if curr-ttype (append (string-split curr-ttype "/") '("runname" "testname")) '()))
(tfilter (or (s:get "target-filter") "%"))
(targets (pgdb:get-targets-of-type dbh selected tfilter))
;; (target (s:session-var-get "target"))
;; (target-patt (or target "%"))
(row-or-col (string-split (or (s:get "row-or-col") "") ","))
(all-data (if (and selected
(not (eq? selected -1)))
(pgdb:get-stats-given-type-target dbh selected tfilter)
(pgdb:get-stats-given-target dbh tfilter)
))
;; (all-data (pgdb:get-tests dbh tfilter))
(ordered-data (pgdb:coalesce-runs dbh all-data all-parts row-or-col 0)))
(s:div 'class "col_12"
(s:fieldset
"Area type and target filter"
(s:form
'action "home.filter" 'method "post"
(s:div 'class "col_12"
(s:div 'class "col_6"
(s:select (map (lambda (x)
(if x
(let ((tt-id (vector-ref x 0))
(ttype (vector-ref x 1)))
(if (eq? tt-id selected)
(list ttype tt-id ttype #t)
(list ttype tt-id ttype #f)))
(list "all" -1 "all" (eq? selected -1))))
(cons #f ttypes))
'name 'target-type))
(s:div 'class "col_4"
(s:input-preserve 'name "tfilter" 'placeholder "Filter targets"))
(s:div 'class "col_2"
(s:input 'type "submit" 'name "set-filter-vals" 'value "Submit")))
;; use radio buttons to select whether to put this identifier in row or column.
;; this seems clumsly and takes up a lot of screen realestate
|
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
(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>=?))
(b-keys (delete-duplicates(sort (apply
append
(map (lambda (sub-key)
(let ((subdat (hash-table-ref ordered-data sub-key)))
(hash-table-keys subdat)))
a-keys))
string>=?))))
; (c-keys (delete-duplicates b-keys)))
(if #f ;; swap rows/cols
(s:table
(s:tr (s:td "")(map s:tr b-keys))
(map
(lambda (row-key)
(let ((subdat (hash-table-ref ordered-data row-key)))
(s:tr (s:td row-key)
(map
(lambda (col-key)
(s:td (let ((dat (hash-table-ref/default subdat col-key #f)))
(s:td (if dat
(list (vector-ref dat 0)(vector-ref dat 1))
"")))))
b-keys))))
a-keys))
(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)
|
|
<
<
<
|
<
<
<
|
|
|
|
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
|
(s:p " Result Format: total / pass / fail / other")
(s:fieldset
(conc "Runs data for " tfilter)
;;
;; A very basic display
;;
(let* ((a-keys (pgdb:ordered-data->a-keys ordered-data))
(b-keys (pgdb:ordered-data->b-keys ordered-data a-keys)))
;; (c-keys (delete-duplicates b-keys)))
(if #f ;; swap rows/cols
(s:table
(s:tr (s:td "")(map s:tr b-keys))
(map
(lambda (row-key)
(let ((subdat (hash-table-ref ordered-data row-key)))
(s:tr (s:td row-key)
(map
(lambda (col-key)
(s:td (let ((dat (hash-table-ref/default subdat col-key #f)))
(s:td (if dat
(list (vector-ref dat 0)(vector-ref dat 1))
"")))))
b-keys))))
a-keys))
(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)
|