anchor.diff:                 (push message (gethash on-id pending-transactions)))))
            (check-gratitude (result-id result)
              (when (eq :gratitude (result-type result))
  -             (let* ((gratitude (db result-id ))
  +             (let* ((gratitude (db result-id))
                       (gratitude-created (getf gratitude :created))
                       (on-item-id (getf gratitude :on))
                       (transactions (gethash on-item-id pending-transactions)))
                  (dolist (transaction transactions)
                    (let* ((transaction-id (message-id transaction))
  -                        (transaction (db transaction-id)))
  -                   (dolist (action (getf transaction :log))
  +                        (data (db transaction-id)))
  +                   (dolist (action (getf data :log))
                        (case (getf action :action)
                          (:gratitude-posted (return))
                          ((or :given :received)
  -                        (when (> gratitude-created (getf action :time))
                             (push (humanize-exact-time (getf action :time)
                                                        :year-first t)
                                   times)
  -                          (pushnew transaction to-be-confirmed)))))))))))
  +                          (pushnew (cons transaction-id
  +                                         (sort (cons
  +                                                 (list :time gratitude-created
  +                                                       :party (list (getf gratitude :author))
  +                                                       :action :gratitude-posted)
  +                                                 (getf data :log))
  +                                               #'>
  +                                               :key (lambda (action)
  +                                                      (getf action :time))))
  +                                   to-be-confirmed
  +                                   :test #'eql
  +                                   :key #'car)
  +                          (return))))))))))
       (maphash #'check-transaction *db-messages*)
       (maphash #'check-gratitude *db-results*))
  -  to-be-confirmed
  -  (values times
  -          (length to-be-confirmed)))
  +  (values
  +    to-be-confirmed
  +    (length to-be-confirmed)))
  +
  +(defun fix-completed-transactions-marked-incomplete
  +  (&aux (to-be-confirmed (multiple-value-list (completed-transactions-marked-incomplete)))
  +        last-fixed)
  +  "Utility to add gratitude-posted to certain transactions that had not had those gratitudes posted due to a bug."
  +  (dolist (pair (car to-be-confirmed))
  +    (setf last-fixed
  +          (cons (car pair)
  +                (modify-db (car pair) :log (cdr pair)))))
  +  (values (cdr to-be-confirmed) last-fixed ))
   
   (defun create-transaction (&key on text action match-id pending-deletion (userid *userid*))
     (let* ((time (get-universal-time))
  
positive.code:                          :party party
                           :action new-action)))
  
    (when (find new-action '(:gave :received))
      (let* ((on-item-id (getf transaction :on))
             (on-item (db on-item-id))
  
negative.code:         ;; k=on-item-id, v=tansactions
          times
          to-be-confirmed)
    "Utility to identify gratitudes that need to be matched with Transactions"
    (flet ((check-transaction (message-id message)
             (when (and (eq (message-type message) :transaction)
                        (transaction-pending-gratitude-p message-id))
  