Skip to content

Commit

Permalink
Merge pull request #88 from kkasai/hotfix/1.0.9
Browse files Browse the repository at this point in the history
Fix import of notifications
  • Loading branch information
kkasai authored Jun 26, 2017
2 parents c6f8841 + 25c65e8 commit e9713b9
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions src/clj/job_streamer/control_bus/component/jobs.clj
Original file line number Diff line number Diff line change
Expand Up @@ -393,19 +393,20 @@
"Save given status notifications."
[{:keys [datomic] :as jobs} job-id settings-list]
(let [notification-count (count settings-list)
status-notification-ids (repeat notification-count (d/tempid :db.part/user))
status-notification-ids (repeatedly notification-count #(d/tempid :db.part/user))
tempids (-> (d/transact
datomic
(->> settings-list
(map #([:db/add job-id
:job/status-notifications %1]
(merge {:db/id %1
:status-notification/type (:status-notification/type %2)}
(when-let [batch-status (:status-notification/batch-status %2)]
{:status-notification/batch-status batch-status})
(when-let [exit-status (:status-notification/exit-status %2)]
{:status-notification/exit-status exit-status})))
status-notification-ids)))
(apply concat (map (fn [notification-id notification]
[[:db/add job-id
:job/status-notifications notification-id]
(merge {:db/id notification-id
:status-notification/type (:status-notification/type notification)}
(when-let [batch-status (:status-notification/batch-status notification)]
{:status-notification/batch-status batch-status})
(when-let [exit-status (:status-notification/exit-status notification)]
{:status-notification/exit-status exit-status}))])
status-notification-ids
settings-list)))
:tempids)]
{:db/ids (->> status-notification-ids
(map #(d/resolve-tempid datomic tempids %))
Expand Down Expand Up @@ -554,7 +555,7 @@
[?job :job/status-notifications ?notifications]]}
app-name (:job/name job))]
(->> notifications
(map #([:db/retract posted-job-id :job/status-notifications %]))
(map (fn [notification] [:db/retract posted-job-id :job/status-notifications notification]))
vec)))
job-query (filter identity (concat [exclusive-query bpmn-xml-notation-query svg-notation-query] notifications-delete-query))]
(d/transact datomic job-query)
Expand Down

0 comments on commit e9713b9

Please sign in to comment.