This commit is contained in:
Andrea Ciceri 2025-05-21 17:59:21 +02:00
parent fd793b791d
commit a7f927516e
No known key found for this signature in database

View file

@ -970,23 +970,23 @@ This is meant to be an helper to be called from the window manager."
"Check if node was created in given time range"
#'org-roam-node-date
#'(lambda (node-date start-date end-date)
(let ((node-date (condition-case nil
;; if the entry is not from the journal (i.e. the filename is not something like "2024-10-10.org")
;; then it's always discarded (the epoch time is given to it)
(encode-time (org-parse-time-string node-date))
(error (encode-time (org-parse-time-string "<1970-01-01>")))))
(start-date (encode-time (org-parse-time-string start-date)))
(end-date (encode-time (org-parse-time-string end-date))))
(and (time-less-p start-date node-date)
(time-less-p node-date end-date)))
))
(let ((node-date (condition-case nil
;; if the entry is not from the journal (i.e. the filename is not something like "2024-10-10.org")
;; then it's always discarded (the epoch time is given to it)
(encode-time (org-parse-time-string node-date))
(error (encode-time (org-parse-time-string "<1970-01-01>")))))
(start-date (encode-time (org-parse-time-string start-date)))
(end-date (encode-time (org-parse-time-string end-date))))
(and (time-less-p start-date node-date)
(time-less-p node-date end-date)))
))
(defun ccr/org-roam-spent-hours (client &optional date-start date-end)
"Return the total spent hours on something (usually a client)"
(let* ((query-tags `(tags ,client "billable"))
(query (if (and date-start date-end)
`(and ,query-tags (date-range ,date-start ,date-end))
query-tags)))
(query (if (and date-start date-end)
`(and ,query-tags (date-range ,date-start ,date-end))
query-tags)))
(apply #'+(mapcar #'org-roam-node-spent (org-roam-ql-nodes query))))))
(use-package org-roam-ql
@ -1064,7 +1064,7 @@ This is meant to be an helper to be called from the window manager."
(defun ccr/edit-buffer (buffer-name old-string new-string)
"In BUFFER-NAME, replace OLD-STRING with NEW-STRING."
(with-current-buffer buffer-name
(let ((case-fold-search nil)) ;; Case-sensitive search
(let ((case-fold-search nil)) ;; Case-sensitive search
(save-excursion
(goto-char (point-min))
(let ((count 0))