|
26 | 26 |
|
27 | 27 | (define-coercion-match-expander hash-arg/m |
28 | 28 | (λ (x) |
29 | | - (and (not (*demo-output*)) |
30 | | - (let ([m (regexp-match #rx"^([0-9a-f]+)\\.[0-9a-f.]+" x)]) |
31 | | - (and m (completed-job? (second m)))))) |
| 29 | + (cond |
| 30 | + [(*demo-output*) |
| 31 | + (not (directory-exists? (build-path (*demo-output*) x)))] |
| 32 | + [else |
| 33 | + (let ([m (regexp-match #rx"^([0-9a-f]+)\\.[0-9a-f.]+" x)]) |
| 34 | + (and m (completed-job? (second m))))])) |
32 | 35 | (λ (x) |
33 | 36 | (let ([m (regexp-match #rx"^([0-9a-f]+)\\.[0-9a-f.]+" x)]) |
34 | 37 | (get-results-for (if m (second m) x))))) |
|
55 | 58 | [((hash-arg) (string-arg)) generate-page] |
56 | 59 | [("results.json") generate-report])) |
57 | 60 |
|
58 | | -(define (generate-page req results page) |
59 | | - (match-define result results) |
60 | | - (define path (string-split (url->string (request-uri req)) "/")) |
| 61 | +(define (generate-page req result page) |
| 62 | + (define path (first (string-split (url->string (request-uri req)) "/"))) |
61 | 63 | (cond |
62 | 64 | [(set-member? (all-pages result) page) |
63 | 65 | ;; Write page contents to disk |
|
80 | 82 | (next-dispatcher)])) |
81 | 83 |
|
82 | 84 | (define (generate-report req) |
83 | | - (define info (make-report-info (get-improve-job-data) #:seed (get-seed) #:note (if (*demo?*) "Web demo results" "Herbie results"))) |
84 | | - (response 200 #"OK" (current-seconds) #"text" |
85 | | - (list (header #"X-Job-Count" (string->bytes/utf-8 (~a (job-count))))) |
86 | | - (λ (out) (write-datafile out info)))) |
| 85 | + (cond |
| 86 | + [(and (*demo-output*) (file-exists? (build-path (*demo-output*) "results.json"))) |
| 87 | + (next-dispatcher)] |
| 88 | + [else |
| 89 | + (define info (make-report-info (get-improve-job-data) #:seed (get-seed) #:note (if (*demo?*) "Web demo results" "Herbie results"))) |
| 90 | + (response 200 #"OK" (current-seconds) #"text" |
| 91 | + (list (header #"X-Job-Count" (string->bytes/utf-8 (~a (job-count))))) |
| 92 | + (λ (out) (write-datafile out info)))])) |
87 | 93 |
|
88 | 94 | (define url (compose add-prefix url*)) |
89 | 95 |
|
|
0 commit comments