import Ember from 'ember';
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';

const { Route, RSVP } = Ember;
const { Promise, all, map } = RSVP;

export default Route.extend(AuthenticatedRouteMixin, {
  afterModel(course){
    return all([
      this.loadCourseLearhingMaterials(course),
      this.loadSessionLearhingMaterials(course),
    ])

  },
  loadCourseLearhingMaterials(course){
    return new Promise(resolve => {
      course.get('learningMaterials').then(courseLearningMaterials => {
        all(courseLearningMaterials.getEach('learningMaterial')).then(()=> {
          resolve();
        })
      });
    });
  },
  loadSessionLearhingMaterials(course){
    return new Promise(resolve => {
      course.get('sessions').then(sessions => {
        map(sessions.toArray(), session => {
          return all([
            session.get('learningMaterials'),
            session.get('firstOfferingDate')
          ]);
        }).then(()=>{
          resolve();
        })
      });
    });
  }
});

@@ -290,33 +290,33 @@
 s.loadCourseLear
-h
+n
 ingMaterials(cou
@@ -339,33 +339,33 @@
 .loadSessionLear
-h
+n
 ingMaterials(cou
@@ -395,25 +395,25 @@
 adCourseLear
-h
+n
 ingMaterials
@@ -679,17 +679,17 @@
 sionLear
-h
+n
 ingMater

Fix typo/miss spell in method names