   [day rowNum]
   (not (timetable-row-empty? day rowNum)))
 
+(defn- timetable-row-get-lessons-satisfying-pred
+  "Returns a sequence of vectors of `TimetableLessonInfo` object and the
+   jQuery <div> element associated with that lesson.
+   The `TimetableLessonInfo` objects must satisfy a criteria given by the
+   `predFn` predicate."
+  [day rowNum predFn]
+  (let [ttRow (timetable-get-day-row day rowNum)]
+    (filter (fn [[ttLessonInfo _]]
+              (predFn ttLessonInfo))
+            ttRow)))
+
 (defn- create-lesson-div
   "Creates a <div> element for a new lesson using jQuery"
   [& {:keys [moduleCode moduleName lessonType lessonGroup venue slotsOcc

    (.log js/console (str "lowTimeIdx = " lowTimeIdx ", highTimeIdx = " highTimeIdx))
    (:augTTLessonInfoMapToShift
      (reduce
        (fn [reduceResult [rowIdx ttRow]]
          (if (empty? ttRow)
              ; Skip empty row
              reduceResult


              (let [occupiedVec (:occupiedVec reduceResult)

                    ttLessonInfoToShift
                    (timetable-row-get-lessons-satisfying-pred
                      day rowIdx
                      (fn [{:keys [startTime endTime]}]
                        (and (>= startTime lowTimeIdx)
                             (<= (dec endTime) highTimeIdx)
                             (not-occupied? occupiedVec startTime endTime))))]
                (.log js/console "suspect above")
                (.log js/console (str "rowIdx = " rowIdx))
                (.log js/console (str "occupiedVec = " (.stringify js/JSON (clj->js occupiedVec))))
