mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-04-13 21:44:40 -04:00
Filter out duplicate course instances client-side
This commit is contained in:
parent
4034d21cd5
commit
abb4e2fa47
1 changed files with 5 additions and 0 deletions
|
@ -53,6 +53,11 @@ module.exports = class ClassroomView extends RootView
|
|||
@sessions = new CocoCollection([], { model: LevelSession })
|
||||
|
||||
onCourseInstancesSync: ->
|
||||
# clear duplicates with lodash magic
|
||||
groups = _.groupBy @courseInstances.models, (ci) -> ci.get('courseID')
|
||||
@courseInstances.reset(_.map(_.values(groups), _.first))
|
||||
# TODO: Make having multiple course instances for a classroom/course pair impossible in the db
|
||||
|
||||
@sessions = new CocoCollection([], { model: LevelSession })
|
||||
for courseInstance in @courseInstances.models
|
||||
sessions = new CocoCollection([], { url: "/db/course_instance/#{courseInstance.id}/level_sessions", model: LevelSession })
|
||||
|
|
Loading…
Add table
Reference in a new issue