                         (get-selected-module-codes-as-js-array))))
 
                 (make-added-lessons-draggable $divElemSeq moduleCode lessonType
-                                              lessonLabel bgColorCssClass)
-                augLessonInfoSeq))))))
+                                              lessonLabel bgColorCssClass)))
+          augLessonInfoSeq))))
 
 (defn add-module
   "Adds a module to the timetable.


; Forward declaration
(declare add-module-lesson-group)

(defn- lesson-draggable-start-evt-handler-maker
  "Returns a function that can be used as the `start` event handler for a

  "Returns a function used as the `stop` event handler for a draggable lesson."
  []
  (fn [evt ui]
    (let [affectedDaysSet
          (reduce (fn [daySet ttLessonInfo]
                    (conj daySet (:day ttLessonInfo)))
                  #{}
                  Lessons-Created-By-Draggable)]

      (doseq [augTTLessonInfo Lessons-Created-By-Draggable]
        (timetable-remove-lesson (:day augTTLessonInfo)
                                 (:rowNum augTTLessonInfo)
                                 (dissoc augTTLessonInfo :divElem :day
                                         :rowNum)))

      (doseq [augTTLessonInfo Lessons-Created-By-Draggable]
        (let [$divElem  (:divElem augTTLessonInfo)
              $parentTd (parent $divElem)]
          ; TODO: This part of the code is the same as in the
          ;       `remove-lesson-group-html` function. Refactor it.
          (remove-attr $parentTd "colspan")
          (.remove $divElem)
          (add-missing-td-elements-replacing-lesson $parentTd augTTLessonInfo)))

      (timetable-prune-empty-rows affectedDaysSet)
      (set! Lessons-Created-By-Draggable nil))))

; TODO: Make lesson type with only a single lessongroup non-draggable
(defn- make-added-lessons-draggable
