fix(grfn/bbbg): Left join to attendees

Change-Id: Ic158a2c77e92410f078b67907b2a9537e2cb1392
This commit is contained in:
Griffin Smith 2021-12-13 21:55:26 -05:00
parent c3cb7b0df8
commit 8bc2e83246

View file

@ -3,7 +3,7 @@
[bbbg.attendee :as attendee] [bbbg.attendee :as attendee]
[bbbg.db :as db] [bbbg.db :as db]
[bbbg.event :as event] [bbbg.event :as event]
[honeysql.helpers :refer [merge-group-by merge-join merge-select]] [honeysql.helpers :refer [merge-group-by merge-left-join merge-select]]
[java-time :refer [local-date]])) [java-time :refer [local-date]]))
(defn create! [db event] (defn create! [db event]
@ -34,7 +34,7 @@
(defn with-attendee-counts (defn with-attendee-counts
[query] [query]
(-> query (-> query
(merge-join :event_attendee [:= :event.id :event_attendee.event-id]) (merge-left-join :event_attendee [:= :event.id :event_attendee.event-id])
(merge-select :%count.event_attendee.attendee_id) (merge-select :%count.event_attendee.attendee_id)
(merge-group-by :event.id :event_attendee.event-id))) (merge-group-by :event.id :event_attendee.event-id)))