                                                [:users [:= :users.user_id
                                                         :yubikeys.user_id]]
                                                :where [:= :users.username
-                                                       username])))
-        key-ids (set (for [id key-rs] (:yubikey_id id)))]
+                                                       username]))
+                        {:row-fn #(:yubikey_id %)})
+        key-ids (set key-rs)]
     (when (pos? (count key-ids))
       {:yubikey-ids key-ids})))
 

  "Returns all the episodes in the database. Returns episode number, name
  date."
  [db-con]
  (let [results (j/query db-con
                         (sql/format
                          (sql/build :select [:number :name :date]
                                     :from :episodes
                                     :order-by [[:number :desc]])))
        format-date (fn [row]
                      (update-in row [:date] sql-ts-to-date-str))]
    (map format-date results)))

(defn get-episode-basic-data
  "Returns the basic data (name and date) of the episode with
  the provided number."
  [db-con episode-number]
  (let [results (j/query db-con
                         (sql/format
                          (sql/build :select [:name :date]
                                     :from :episodes
                                     :where [:= :number (Integer/parseInt
                                                         episode-number)])))
        format-date (fn [row]
                      (update-in row [:date] sql-ts-to-date-str))]
    (first (map format-date results))))

(defn get-episode-tracks
  "Returns the track name, artist and possible feature of each track in the

(defn get-all-artists
  "Returns all artists' names from the database."
  [db-con]
  (j/query db-con
           (sql/format
            (sql/build :select :name
                       :from :artists
                       :order-by [[:name :asc]]))
           {:row-fn #(:name %)}))

(defn get-episodes-with-track
  "Returns track name, artist, episode name and number of the provided track."
