Function: eca-jobs--group-by-chat

eca-jobs--group-by-chat is a natively compiled function defined in eca-jobs.el.

Signature

(eca-jobs--group-by-chat JOBS)

Documentation

Group JOBS by :chat-id, returning alist of (chat-id . (chat-label . jobs)).

Source Code

;; Defined in /nix/store/jklqzw6pzz6j4jrbv8wy0iwgi7jlrbld-emacs-packages-deps/share/emacs/site-lisp/elpa/eca-20260928.1827/eca-jobs.el
(defun eca-jobs--group-by-chat (jobs)
  "Group JOBS by :chat-id, returning alist of (chat-id . (chat-label . jobs))."
  (let ((groups nil))
    (seq-doseq (job jobs)
      (let* ((chat-id (or (plist-get job :chatId) "unknown"))
             (chat-label (or (plist-get job :chatLabel) "Unknown Chat"))
             (existing (assoc chat-id groups)))
        (if existing
            (setcdr existing (cons chat-label
                                   (append (cddr existing) (list job))))
          (push (cons chat-id (cons chat-label (list job))) groups))))
    (nreverse groups)))