feat(grfn/bbbg): Only show attendees who haven't signed in
Change-Id: I524fe3f7584fe8a0fbaecbce62f9f875a1735b96 Reviewed-on: https://cl.tvl.fyi/c/depot/+/4633 Reviewed-by: grfn <grfn@gws.fyi> Autosubmit: grfn <grfn@gws.fyi> Tested-by: BuildkiteCI
This commit is contained in:
parent
80ef71e995
commit
f7d6ad1cea
2 changed files with 19 additions and 11 deletions
|
@ -23,12 +23,13 @@
|
||||||
(db/list db (search query q))))
|
(db/list db (search query q))))
|
||||||
|
|
||||||
(defn for-event
|
(defn for-event
|
||||||
|
([event-id]
|
||||||
|
(for-event {:select [:attendee.*]
|
||||||
|
:from [:attendee]}
|
||||||
|
event-id))
|
||||||
([db-or-query event-id]
|
([db-or-query event-id]
|
||||||
(if (db/database? db-or-query)
|
(if (db/database? db-or-query)
|
||||||
(for-event db-or-query
|
(db/list db-or-query (for-event event-id))
|
||||||
{:select [:attendee.*]
|
|
||||||
:from [:attendee]}
|
|
||||||
event-id)
|
|
||||||
(-> db-or-query
|
(-> db-or-query
|
||||||
(merge-join :event_attendee [:= :attendee.id :event_attendee.attendee_id])
|
(merge-join :event_attendee [:= :attendee.id :event_attendee.attendee_id])
|
||||||
(merge-where [:= :event_attendee.event_id event-id]))))
|
(merge-where [:= :event_attendee.event_id event-id]))))
|
||||||
|
|
|
@ -1,15 +1,17 @@
|
||||||
(ns bbbg.handlers.signup-form
|
(ns bbbg.handlers.signup-form
|
||||||
(:require
|
(:require
|
||||||
|
[bbbg.attendee :as attendee]
|
||||||
[bbbg.db :as db]
|
[bbbg.db :as db]
|
||||||
|
[bbbg.db.attendee :as db.attendee]
|
||||||
[bbbg.db.event :as db.event]
|
[bbbg.db.event :as db.event]
|
||||||
[bbbg.event :as event]
|
[bbbg.event :as event]
|
||||||
[bbbg.handlers.core :refer [page-response authenticated? *authenticated?*]]
|
[bbbg.handlers.core
|
||||||
[compojure.core :refer [GET context]]
|
:refer [*authenticated?* authenticated? page-response]]
|
||||||
[java-time :refer [local-date]]
|
|
||||||
[ring.util.response :refer [redirect]]
|
|
||||||
[bbbg.db.attendee :as db.attendee]
|
|
||||||
[cheshire.core :as json]
|
[cheshire.core :as json]
|
||||||
[bbbg.attendee :as attendee]))
|
[compojure.core :refer [context GET]]
|
||||||
|
[honeysql.helpers :refer [merge-where]]
|
||||||
|
[java-time :refer [local-date]]
|
||||||
|
[ring.util.response :refer [redirect]]))
|
||||||
|
|
||||||
(defn no-events-page [{:keys [authenticated?]}]
|
(defn no-events-page [{:keys [authenticated?]}]
|
||||||
[:div.no-events
|
[:div.no-events
|
||||||
|
@ -76,7 +78,12 @@
|
||||||
|
|
||||||
(GET "/:event-id" [event-id]
|
(GET "/:event-id" [event-id]
|
||||||
(if-let [event (db/get db :event event-id)]
|
(if-let [event (db/get db :event event-id)]
|
||||||
(let [attendees (db.attendee/for-event db event-id)]
|
(let [attendees (db/list db
|
||||||
|
(->
|
||||||
|
(db.attendee/for-event event-id)
|
||||||
|
(merge-where [:or
|
||||||
|
[:= :attended nil]
|
||||||
|
[:not :attended]])))]
|
||||||
(page-response
|
(page-response
|
||||||
(signup-page {:event event
|
(signup-page {:event event
|
||||||
:attendees attendees})))
|
:attendees attendees})))
|
||||||
|
|
Loading…
Reference in a new issue