| 396 | }) |
| 397 | |
| 398 | const fetchSessions = (instance) => { |
| 399 | return new Promise((resolve, reject) => { |
| 400 | const fetchOptions = { |
| 401 | data: { project: 'state.complete,level.original,playtime,changed' }, |
| 402 | success: (collection, response, options) => { |
| 403 | resolve(collection) |
| 404 | }, |
| 405 | error: (collection, response, options) => { |
| 406 | reject(response) |
| 407 | }, |
| 408 | } |
| 409 | |
| 410 | const collection = new CocoCollection([], { |
| 411 | url: instance.url() + '/course-level-sessions/' + me.id, |
| 412 | model: LevelSession, |
| 413 | }) |
| 414 | collection.comparator = 'changed' |
| 415 | collection.fetch(fetchOptions) |
| 416 | }) |
| 417 | } |
| 418 | const dynamicLoadLanguageSessions = async () => { |
| 419 | // classrooms has same language shares progress, so we only need to fetch session once |
| 420 | const languageSessions = { others: {} } |