about summary refs log tree commit diff
path: root/users/grfn/bbbg
diff options
context:
space:
mode:
authorGriffin Smith <grfn@gws.fyi>2021-12-26T14·50-0500
committerclbot <clbot@tvl.fyi>2021-12-26T16·04+0000
commitf7d6ad1cea5b5604197924f2122428e02db8f629 (patch)
tree39995e8abb1423b549f4f12061c003c2c58d93d7 /users/grfn/bbbg
parent80ef71e9958d0effe0ea1e1fb39b7200e02eff70 (diff)
feat(grfn/bbbg): Only show attendees who haven't signed in r/3415
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
Diffstat (limited to 'users/grfn/bbbg')
-rw-r--r--users/grfn/bbbg/src/bbbg/db/attendee.clj9
-rw-r--r--users/grfn/bbbg/src/bbbg/handlers/signup_form.clj21
2 files changed, 19 insertions, 11 deletions
diff --git a/users/grfn/bbbg/src/bbbg/db/attendee.clj b/users/grfn/bbbg/src/bbbg/db/attendee.clj
index 68c3636e9502..91e13e07f860 100644
--- a/users/grfn/bbbg/src/bbbg/db/attendee.clj
+++ b/users/grfn/bbbg/src/bbbg/db/attendee.clj
@@ -23,12 +23,13 @@
    (db/list db (search query q))))
 
 (defn for-event
+  ([event-id]
+   (for-event {:select [:attendee.*]
+               :from [:attendee]}
+              event-id))
   ([db-or-query event-id]
    (if (db/database? db-or-query)
-     (for-event db-or-query
-                {:select [:attendee.*]
-                 :from [:attendee]}
-                event-id)
+     (db/list db-or-query (for-event event-id))
      (-> db-or-query
          (merge-join :event_attendee [:= :attendee.id :event_attendee.attendee_id])
          (merge-where [:= :event_attendee.event_id event-id]))))
diff --git a/users/grfn/bbbg/src/bbbg/handlers/signup_form.clj b/users/grfn/bbbg/src/bbbg/handlers/signup_form.clj
index 4485327a7b1b..fdc6243804f1 100644
--- a/users/grfn/bbbg/src/bbbg/handlers/signup_form.clj
+++ b/users/grfn/bbbg/src/bbbg/handlers/signup_form.clj
@@ -1,15 +1,17 @@
 (ns bbbg.handlers.signup-form
   (:require
+   [bbbg.attendee :as attendee]
    [bbbg.db :as db]
+   [bbbg.db.attendee :as db.attendee]
    [bbbg.db.event :as db.event]
    [bbbg.event :as event]
-   [bbbg.handlers.core :refer [page-response authenticated? *authenticated?*]]
-   [compojure.core :refer [GET context]]
-   [java-time :refer [local-date]]
-   [ring.util.response :refer [redirect]]
-   [bbbg.db.attendee :as db.attendee]
+   [bbbg.handlers.core
+    :refer [*authenticated?* authenticated? page-response]]
    [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?]}]
   [:div.no-events
@@ -76,7 +78,12 @@
 
    (GET "/:event-id" [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
           (signup-page {:event event
                         :attendees attendees})))