Megatest

Check-in [d4ffcebff2]
Login
Overview
Comment:Fixed sorting on buttons in dashboard
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | fixup
Files: files | file ages | folders
SHA1: d4ffcebff292e5a02d7c312115a7d9c8eba8d926
User & Date: mrwellan on 2011-09-28 11:18:44
Other Links: branch diff | manifest | tags
Context
2011-10-01
17:43
Tweaked eh Closed-Leaf check-in: b3e41a697b user: mrwellan tags: fixup (unpublished)
2011-09-28
11:18
Fixed sorting on buttons in dashboard check-in: d4ffcebff2 user: mrwellan tags: fixup (unpublished)
10:10
Fixed bug check-in: ab830bcc7c user: mrwellan tags: fixup (unpublished)
Changes

Modified dashboard.scm from [f4b8fd3a36] to [ea9316dcf0].

1
2
3
4
5
6
7
8
;;======================================================================
;; Copyright 2006-2011, Matthew Welland.
;; 
;;  This program is made available under the GNU GPL version 2.0 or
;;  greater. See the accompanying file COPYING for details.
;; 
;;  This program is distributed WITHOUT ANY WARRANTY; without even the
;;  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|







1
2
3
4
5
6
7
8
k;;======================================================================
;; Copyright 2006-2011, Matthew Welland.
;; 
;;  This program is made available under the GNU GPL version 2.0 or
;;  greater. See the accompanying file COPYING for details.
;; 
;;  This program is distributed WITHOUT ANY WARRANTY; without even the
;;  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
214
215
216
217
218
219
220
221










222
223
224
225
226
227
228
229
230
231
232
233
234











235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
	  ;(iup:attribute-set! btn "FGCOLOR" "0 0 0")
	  (hash-table-delete! *collapsed* basetestname))
	(begin
	  ;(iup:attribute-set! btn "FGCOLOR" "0 192 192")
	  (hash-table-set! *collapsed* basetestname #t)))))
  
(define blank-line-rx (regexp "^\\s*$"))











(define (collapse-rows inlst)
  (let ((newlst (filter (lambda (x)
			  (let* ((tparts    (string-split x "("))
				 (basetname (if (null? tparts) x (car tparts))))
					;(print "x " x " tparts: " tparts " basetname: " basetname)
			    (cond
			     ((string-match blank-line-rx x) #f)
			     ((equal? x basetname) #t)
			     ((hash-table-ref/default *collapsed* basetname #f) 
					;(print "Removing " basetname " from items")
			      #f)
			     (else #t))))
			inlst)))











    ;; special sort to push the test(item) to after test
    (sort newlst (lambda (a b)
		   (let* ((partsa (string-split a "("))
			  (partsb (string-split b "("))
			  (lena   (length partsa))
			  (lenb   (length partsb)))
		     (if (or (and (eq? lena 1)(> lenb 1))
			     (and (eq? lenb 1)(> lena 1)))
			 (if (equal? (car partsa)(car partsb)) ;; same test
			     (> lenb lena)
			     #t)
			 #t))))))
			     
(define (update-labels uidat)
  (let* ((rown    0)
	 (lftcol  (vector-ref uidat 0))
	 (numcols (vector-length lftcol))
	 (maxn    (- numcols 1))
	 (allvals (make-vector numcols "")))








>
>
>
>
>
>
>
>
>
>

|










|
>
>
>
>
>
>
>
>
>
>
>
|
|
|
|
|
|
|
|
|
|
|
|







214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
	  ;(iup:attribute-set! btn "FGCOLOR" "0 0 0")
	  (hash-table-delete! *collapsed* basetestname))
	(begin
	  ;(iup:attribute-set! btn "FGCOLOR" "0 192 192")
	  (hash-table-set! *collapsed* basetestname #t)))))
  
(define blank-line-rx (regexp "^\\s*$"))

(define (run-item-name->vectors lst)
  (map (lambda (x)
	 (let ((splst (string-split x "("))
	       (res   (vector "" "")))
	   (vector-set! res 0 (car splst))
	   (if (> (length splst) 1)
	       (vector-set! res 1 (car (string-split (cadr splst) ")"))))
	   res))
       lst))

(define (collapse-rows inlst)
  (let* ((newlst (filter (lambda (x)
			  (let* ((tparts    (string-split x "("))
				 (basetname (if (null? tparts) x (car tparts))))
					;(print "x " x " tparts: " tparts " basetname: " basetname)
			    (cond
			     ((string-match blank-line-rx x) #f)
			     ((equal? x basetname) #t)
			     ((hash-table-ref/default *collapsed* basetname #f) 
					;(print "Removing " basetname " from items")
			      #f)
			     (else #t))))
			inlst))
	 (vlst  (run-item-name->vectors newlst))
	 ;; sort by second field
	 (vlst-s1 (sort vlst (lambda (a b)
			       (>= (string-length (vector-ref a 1))(string-length (vector-ref b 1))))))
	 (vlst-s2 (sort vlst-s1 (lambda (a b)
				  (string>= (vector-ref a 0)(vector-ref b 0))))))
    (map (lambda (x)
	   (if (equal? (vector-ref x 1) "")
	       (vector-ref x 0)
	       (conc (vector-ref x 0) "(" (vector-ref x 1) ")")))
	 vlst-s2)))
    
    ;; (sort newlst (lambda (a b)
    ;;     	   (let* ((partsa (string-split a "("))
    ;;     		  (partsb (string-split b "("))
    ;;     		  (lena   (length partsa))
    ;;     		  (lenb   (length partsb)))
    ;;     	     (if (or (and (eq? lena 1)(> lenb 1))
    ;;     		     (and (eq? lenb 1)(> lena 1)))
    ;;     		 (if (equal? (car partsa)(car partsb)) ;; same test
    ;;     		     (> lenb lena)
    ;;     		     #t)
    ;;     		 #t))))))
			     
(define (update-labels uidat)
  (let* ((rown    0)
	 (lftcol  (vector-ref uidat 0))
	 (numcols (vector-length lftcol))
	 (maxn    (- numcols 1))
	 (allvals (make-vector numcols "")))