Skip to content

Commit 19498f6

Browse files
committed
fixed list error for locations
1 parent 93dd5e9 commit 19498f6

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

src/reports/timeline.rkt

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -355,21 +355,25 @@
355355
(tr (th "Operator") (th "Subexpression") (th "Explanation") (th "Count") (th "Locations")))
356356
,@(append*
357357
(for/list ([rec (in-list (sort explanations > #:key fourth))])
358-
(match-define (list op expr expl cnt mcnt flows locations) rec)
358+
(match-define (list op expr expl cnt mcnt flows locations) rec)
359359

360-
;; Ensure locations is always a list or handle it properly
361-
(define safe-locations (if (list? locations) locations '()))
360+
(define safe-locations (or locations '())) ;; Fallback to empty list if locations is #f
362361

363-
(append (list `(tr (td (code ,(~a op)))
362+
(append (list `(tr (td (code ,(~a op)))
364363
(td (code ,(~a expr)))
365364
(td (b ,(~a expl)))
366365
(td ,(~a cnt))
367366
(td ,(~a mcnt))
368-
;; Handle locations as a list or provide a fallback
369-
(td (code ,(string-join (map ~a safe-locations) ", "))))
367+
;; Handle flows: Iterate over each flow and create a row
370368
(for/list ([flow (in-list (or flows '()))])
371369
(match-define (list ex type v) flow)
372-
`(tr (td "") (td (code ,(~a ex))) (td ,type) (td ,(~a v)))))))))))))
370+
(tr (td "") (td (code ,(~a ex))) (td ,type) (td ,(~a v))))
371+
372+
;; Handle locations: Iterate over each location's inner lists and create a row for each
373+
(for/list ([location-list (in-list safe-locations)])
374+
;; Handle each location in the inner list
375+
(for/list ([location (in-list location-list)])
376+
`(tr (td "") (td "Location") (td ,(~a location)) (td ""))))))))))))))
373377

374378
(define (render-phase-confusion confusion-matrix)
375379
(match-define (list (list true-pos false-neg false-pos true-neg)) confusion-matrix)

0 commit comments

Comments
 (0)