fix(clock): duplicate clock-in log twice

1. `set-marker` will not log time anymore. The time logging is moved
to `with-timetracking`
2. Concat `logbook` only if `new-clocks` is nil, which fixs the
duplication of clock-in log.
pull/2777/head
leizhe 2021-09-04 10:27:30 +09:00 committed by Tienson Qin
parent c79e9f9e3e
commit a76df9ce97
2 changed files with 3 additions and 4 deletions

View File

@ -339,8 +339,8 @@
content (if (and (seq properties) real-content (not= real-content content))
(property/with-built-in-properties properties content format)
content)
content (drawer/with-logbook block content)
content (with-timetracking block content)
content (drawer/with-logbook block content)
first-block? (= left page)
ast (mldoc/->edn (string/trim content) (mldoc/default-config format))
first-elem-type (first (ffirst ast))
@ -831,8 +831,7 @@
(defn set-marker
[{:block/keys [uuid marker content format properties] :as block} new-marker]
(let [new-content (-> (string/replace-first content (re-pattern (str "^" marker)) new-marker)
(with-marker-time block format new-marker marker))]
(let [new-content (string/replace-first content (re-pattern (str "^" marker)) new-marker)]
(save-block-if-changed! block new-content)))
(defn set-priority

View File

@ -119,7 +119,7 @@
logbook (get-logbook body)]
(if logbook
(let [content (remove-logbook content)
clocks (->> (concat new-clocks (last logbook))
clocks (->> (concat new-clocks (when-not new-clocks (last logbook)))
(distinct))
clocks (->> (map string/trim clocks)
(remove string/blank?))