Create interval objects from query

This commit is contained in:
contrapunctus 2022-04-18 20:09:13 +05:30
parent c9ab8b4f95
commit 0021f92e29

View File

@ -2262,7 +2262,9 @@ ORDER BY interval_id DESC;")
"SELECT interval_id FROM date_intervals WHERE date_id = ?;" "SELECT interval_id FROM date_intervals WHERE date_id = ?;"
date-id))) date-id)))
(intervals (intervals
(multiple-value-bind (string values) (loop
for (name start stop properties)
in (multiple-value-bind (string values)
(yield (yield
(select (:name :start_time :stop_time :properties) (select (:name :start_time :stop_time :properties)
(from :intervals) (from :intervals)
@ -2272,7 +2274,13 @@ ORDER BY interval_id DESC;")
(select (:interval_id) (select (:interval_id)
(from :date_intervals) (from :date_intervals)
(where (:= :date_id date-id))))))) (where (:= :date_id date-id)))))))
(apply #'execute-to-list connection string values))) (apply #'execute-to-list connection string values))
collect (make-instance 'chronometrist:interval
:activity name
:start start
:stop stop
:properties (when properties
(read-from-string properties)))))
(event-ids (event-ids
(flatten (execute-to-list (flatten (execute-to-list
connection connection