diff options
Diffstat (limited to 'users')
-rw-r--r-- | users/grfn/bbbg/src/bbbg/db/attendee.clj | 21 | ||||
-rw-r--r-- | users/grfn/bbbg/src/bbbg/db/event_attendee.clj | 19 |
2 files changed, 21 insertions, 19 deletions
diff --git a/users/grfn/bbbg/src/bbbg/db/attendee.clj b/users/grfn/bbbg/src/bbbg/db/attendee.clj index 58295642787c..da5ee29321fb 100644 --- a/users/grfn/bbbg/src/bbbg/db/attendee.clj +++ b/users/grfn/bbbg/src/bbbg/db/attendee.clj @@ -54,16 +54,17 @@ (defn upsert-all! [db attendees] - (db/list - db - {:insert-into :attendee - :values (map #(->> % - (db/process-key-map :attendee) - (u/map-keys keyword)) - attendees) - :upsert {:on-conflict [:meetup-user-id] - :do-update-set [:meetup-name]} - :returning [:id :meetup-user-id]})) + (when (seq attendees) + (db/list + db + {:insert-into :attendee + :values (map #(->> % + (db/process-key-map :attendee) + (u/map-keys keyword)) + attendees) + :upsert {:on-conflict [:meetup-user-id] + :do-update-set [:meetup-name]} + :returning [:id :meetup-user-id]}))) (comment (def db (:db bbbg.core/system)) diff --git a/users/grfn/bbbg/src/bbbg/db/event_attendee.clj b/users/grfn/bbbg/src/bbbg/db/event_attendee.clj index 9fa8ad47980d..31411e5d4504 100644 --- a/users/grfn/bbbg/src/bbbg/db/event_attendee.clj +++ b/users/grfn/bbbg/src/bbbg/db/event_attendee.clj @@ -5,12 +5,13 @@ (defn upsert-all! [db attendees] - (db/execute! - db - {:insert-into :event-attendee - :values (map #(->> % - (db/process-key-map :event-attendee) - (u/map-keys keyword)) - attendees) - :upsert {:on-conflict [:event-id :attendee-id] - :do-update-set [:rsvpd-attending]}})) + (when (seq attendees) + (db/execute! + db + {:insert-into :event-attendee + :values (map #(->> % + (db/process-key-map :event-attendee) + (u/map-keys keyword)) + attendees) + :upsert {:on-conflict [:event-id :attendee-id] + :do-update-set [:rsvpd-attending]}}))) |