From dd5ce5c86b2b9debf9890884e8e2e4b8ad9465e6 Mon Sep 17 00:00:00 2001 From: Logan Hunt Date: Sat, 4 Jun 2022 13:28:23 -0700 Subject: [PATCH] add actual assocation between the statistics elements --- database/run.lisp | 17 +++++++++-------- main.lisp | 2 +- ui.lisp | 2 +- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/database/run.lisp b/database/run.lisp index 3166041..5b7d24b 100644 --- a/database/run.lisp +++ b/database/run.lisp @@ -69,12 +69,13 @@ (sxql:where (:= :category_id (mito:object-id category))))) -(defun statistics (category-splits) - `((SPLIT-PBS ,(mapcar (lambda (category) (getf (best-category-split category) :ELAPSED)) csplits)) - (BEST-CATEGORY-RUN-SPLITS ,(or - (mapcar (lambda (split) - (millis-since-internal-timestamp 0 (run-split-elapsed-time split))) - (ignore-errors - (run-splits (mito:find-dao 'run :id (getf (best-category-run category) :RUN-ID))))) - (mapcar (lambda (csplit) nil) csplits))))) +(defun statistics (category) + (let ((csplits (category-splits category))) + `((SPLIT-PBS . ,(mapcar (lambda (csplit) (getf (best-category-split csplit) :ELAPSED)) csplits)) + (BEST-CATEGORY-RUN-SPLITS . ,(or + (mapcar (lambda (split) + (millis-since-internal-timestamp 0 (run-split-elapsed-time split))) + (ignore-errors + (run-splits (mito:find-dao 'run :id (getf (best-category-run category) :RUN-ID))))) + (mapcar (lambda (csplit) nil) csplits)))))) diff --git a/main.lisp b/main.lisp index 8449181..58e2fbe 100644 --- a/main.lisp +++ b/main.lisp @@ -109,9 +109,9 @@ (let ((choice (select-option '(("Help" . HELP) ("Import a category" . IMPORT-CATEGORY) ("Make a new category" . NEW-CATEGORY) - ("Delete a category" . DELETE-CATEGORY) ("Start a speedrun" . START-SPEEDRUN) ("View splits of a speedrun" . VIEW-SPEEDRUNS) + ("Delete a category" . DELETE-CATEGORY) ("Delete a speedrun" . DELETE-SPEEDRUN) ("Exit" . EXIT))))) (case choice diff --git a/ui.lisp b/ui.lisp index 6ab3e8b..16163a4 100644 --- a/ui.lisp +++ b/ui.lisp @@ -110,7 +110,7 @@ (redraws '(title-instance)) (speedrun (make-speedrun category)) (csplits (category-splits category)) - (bests (statistics csplits)) + (bests (statistics category)) (split-pbs (cdr (assoc 'SPLIT-PBS bests))) (best-category-run-pbs (cdr (assoc 'BEST-CATEGORY-RUN-SPLITS bests))))