From 39d01b75ac679410821ce5e16c09ec6b7799f791 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Wed, 27 May 2026 20:47:35 -0500 Subject: refactor: thread card-state struct through the item-data round-trip Second step of #147. get-item-data now returns an org-drill-card-state and store-item-data takes one, so the six recall fields move as named slots instead of a positional list. The three call sites (smart-reschedule, hypothetical-next-review-date, copy-scheduling-to-marker) read scheduler inputs through accessors and build a struct for the store, which removes the hand re-ordering between the get-shape and the store-shape. Behavior is unchanged. The legacy LEARN_DATA read path and the virgin-item sentinel are preserved field-for-field, and store takes just the struct because its last-interval slot already holds the interval to persist. The schedulers still take positional args; they adopt the struct in the following commits. I updated the round-trip, integration, and setup-helper tests to build and read the struct via a small list-view helper, so the existing expected-value assertions stay readable. --- tests/test-org-drill-orchestration-helpers.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tests/test-org-drill-orchestration-helpers.el') diff --git a/tests/test-org-drill-orchestration-helpers.el b/tests/test-org-drill-orchestration-helpers.el index 5589fa7..774f664 100644 --- a/tests/test-org-drill-orchestration-helpers.el +++ b/tests/test-org-drill-orchestration-helpers.el @@ -211,7 +211,7 @@ the resume hint." (insert "* Question :drill:\n") (org-mode) (goto-char (point-min)) - (org-drill-store-item-data 10 3 1 5 3.8 2.4) + (org-drill-store-item-data (make-org-drill-card-state :last-interval 10 :repetitions 3 :failures 1 :total-repeats 5 :meanq 3.8 :ease 2.4)) (org-drill--copy-scheduling-to-marker dst-marker))) (with-current-buffer (find-file-noselect dst-file) (goto-char (point-min)) @@ -254,7 +254,7 @@ the resume hint." (ert-deftest test-strip-unmatched-dest-entries-clears-properties () "Every entry left in the table has its scheduling props stripped." (with-org-tempfile "* Question :drill:\n" - (org-drill-store-item-data 10 3 1 5 3.8 2.4) + (org-drill-store-item-data (make-org-drill-card-state :last-interval 10 :repetitions 3 :failures 1 :total-repeats 5 :meanq 3.8 :ease 2.4)) (clrhash org-drill-dest-id-table) (puthash "stale-id" (point-marker) org-drill-dest-id-table) (org-drill--strip-unmatched-dest-entries) -- cgit v1.2.3