<commit_before>(ns herder.schedule
  (:require
   [herder.helpers :refer [convention-header to-date]]
   [herder.state :refer [state]]
   [herder.getter :refer [get-data get-mapped-data]]
   [goog.string :as gstring]))

(def count-map
  {1 ""
   2 "Second"
   3 "Third"
   4 "Fourth"
   5 "Fifth"})

(defn ^:export component []
  (let [schedule (get-data [:schedule (:id @state)])
        slots (get-mapped-data [:slots (:id @state)])
        schedule-issues (get-data [:schedule-issues (:id @state)])]
    [:div {:class "container-fluid"}
     [convention-header :schedule]
     [:h2 "Schedule"]
     (into [:ul]
           (for [{:keys [id date event_id slot_id event_day]} (sort-by :date schedule)
                 :let [event (get-data [:event (:id @state) event_id])
                       slot (get slots slot_id)
                       day-name (if (= 1 event_day) "" (gstring/format "(%s) " (get count-map (js/parseInt event_day))))]]
             ^{:key id} [:li [:a {:href (str "#/events/" event_id)} (:name event)] " " day-name (to-date date) " " (:start slot) "-" (:end slot)]))
     (if (-> schedule-issues empty? not)
       [:div
        [:h3 "Issues"]
        (into [:ul]
              (for [{:keys [id issue score level events]} (sort-by :level schedule-issues)]
                ^{:key id}
                [:li (if (= level 1) "soft" "hard") " " score ": " issue
                 (into [:ul]
                       (for [event_id events
                             :let [event (get-data [:event (:id @state) event_id])]]
                         [:li [:a {:href (str "#/events/" event_id)} (:name event)]]))]))])]))<commit_msg>Add schedule layout, fixes #9<commit_after>(ns herder.schedule
  (:require
   [herder.helpers :refer [convention-header to-date]]
   [herder.state :refer [state]]
   [herder.getter :refer [get-data get-mapped-data]]
   [goog.string :as gstring]))

(def count-map
  {1 ""
   2 "Second"
   3 "Third"
   4 "Fourth"
   5 "Fifth"})

(defn make-link [item]
  (let [event (get-data [:event (:id @state) (:event_id item)])
        event_day (:event_day item)
        day-name (if (= 1 event_day) "" (gstring/format "(%s) " (get count-map (js/parseInt event_day))))]
    [[:a {:href (str "#/events/" (:id event))} (:name event)] " " day-name]))

(defn ^:export component []
  (let [schedule (get-data [:schedule (:id @state)])
        slots (get-mapped-data [:slots (:id @state)])
        schedule-issues (get-data [:schedule-issues (:id @state)])
        slot-width (quot 11 (count slots))
        days (distinct (map :date schedule))]
    [:div {:class "container-fluid"}
     [convention-header :schedule]
     [:h2 "Schedule"]
     [:table.table
      [:thead
       [:tr
        (cons
         (with-meta [:th ""] {:key "corner-slot"})
         (for [slot (sort-by :start (vals slots))]
           (with-meta [:th (:start slot) "-" (:end slot)] {:key (:id slot)})))]]
      (into [:tbody]
            (for [day days]
              [:tr
               (cons
                (with-meta [:td (to-date day)] {:key day})
                (doall (for [slot_id (map :id (sort-by :start (vals slots)))
                             :let [items (filter #(and
                                                   (= (:date %) day)
                                                   (= (:slot_id %) slot_id))
                                                 schedule)
                                   links (mapv make-link items)
                                   links (cons (first links) (map #(cons "/ " %) (rest links)))
                                   link (into [:td] (apply concat links))]]
                         (do
                           (js/console.log "link" (pr-str link))
                           (with-meta link {:key (str slot_id "-" day)})))))]))]
     (if (-> schedule-issues empty? not)
       [:div
        [:h3 "Issues"]
        (into [:ul]
              (for [{:keys [id issue score level events]} (sort-by :level schedule-issues)]
                ^{:key id}
                [:li (if (= level 1) "soft" "hard") " " score ": " issue
                 (into [:ul]
                       (for [event_id events
                             :let [event (get-data [:event (:id @state) event_id])]]
                         [:li [:a {:href (str "#/events/" event_id)} (:name event)]]))]))])]))
{'fraction_non_alphanumeric': 0.17552334943639292, 'fraction_numerical': 0.004830917874396135, 'mean_word_length': 1.714107365792759, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 9, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2949431', 'n_tokens_mistral': 1422, 'n_tokens_neox': 1334, 'n_words': 385}