diff --git a/src/co/gaiwan/compass/db/queries.clj b/src/co/gaiwan/compass/db/queries.clj index b5cffbe..25dfed6 100644 --- a/src/co/gaiwan/compass/db/queries.clj +++ b/src/co/gaiwan/compass/db/queries.clj @@ -5,11 +5,21 @@ #_(set! *print-namespace-maps* false) +(defn ?resolve-ident + "Maybe resolve ident + + We gave some entities idents, which messes up `db/entity`, which thinks you're + dealing with an enum, and 'helpfully' returns a keyword." + [o] + (if (keyword? o) + (db/entity o) + o)) + (defn session [id] (let [e (db/entity id)] (-> (into {:db/id (:db/id e)} e) - (update :session/type db/entity) - (update :session/location db/entity) + (update :session/type ?resolve-ident) + (update :session/location ?resolve-ident) (assoc :session/signup-count (count (:session/participants e)))))) (defn all-sessions diff --git a/src/co/gaiwan/compass/routes/sessions.clj b/src/co/gaiwan/compass/routes/sessions.clj index 951fccf..37cae46 100644 --- a/src/co/gaiwan/compass/routes/sessions.clj +++ b/src/co/gaiwan/compass/routes/sessions.clj @@ -60,7 +60,6 @@ duration (str "PT" duration-time "M")] (cond-> {:db/id "session" :session/title title - :session/subtitle subtitle :session/time start :session/duration duration :session/description description @@ -68,6 +67,9 @@ :session/location (or (some-> location parse-long) :location.type/hal5-long-table) :session/organized (parse-long organizer-id) :session/capacity (parse-long capacity)} + + subtitle + (assoc :session/subtitle subtitle) (= ticket-required? "on") (assoc :session/ticket-required? true) (= published? "on") @@ -88,7 +90,7 @@ :ticket-required? \"on\" :published? \"on\"}" [{:keys [params]}] - (let [{:keys [tempids]} @(db/transact [(params->session-data params)])] + (let [{:keys [tempids]} @(db/transact [(doto (params->session-data params) prn)])] (response/redirect ["/sessions" (get tempids "session")] {:flash "Successfully created!"})))