     getPageExerciseTypes: (pageId) ->
       _.unique _.flatten _.map @_exercises[pageId], @exports.getExerciseTypes
 
-    # poolTypes: (exercise) ->
-    #   _.without( exercise.pool_types, 'all_exercises')
-
     allForPage: (pageId) ->
       @_exercises[pageId] or []
 

filterForPoolType = (exercises, pool_type) ->
  _.filter exercises, (exercise) -> -1 isnt exercise.pool_types.indexOf(pool_type)

groupBySortedSections = ( exercises ) ->
  sections = {}
  grouped = _.groupBy(exercises, getChapterSection)
  for section in _.sortBy( _.keys(grouped), ContentHelpers.chapterSectionToNumber)
    sections[section] = grouped[section]
  sections

      else
        @_exerciseCache[exerciseId]?.is_excluded

    getChapterSectionOfExercise: (ecosystemId, exercise) ->
      getChapterSection(ecosystemId, exercise)

    groupBySectionsAndTypes: (ecosystemId, pageIds, options = {withExcluded: false}) ->
      all = @_exercises[pageIds.toString()] or []
      unless options.withExcluded is true
        all = _.filter( all, (ex) -> ex.is_excluded isnt true )
      results = {
        all:
          count: all.length
          grouped: groupBySortedSections(ecosystemId, all)
      }
      for name, pool_type of EXERCISE_TYPE_MAPPING
        exercises = filterForPoolType(all, pool_type)
        results[name] = {
          count: exercises.length
          grouped: groupBySortedSections(ecosystemId, exercises)
        }
      results

