MCPcopy Create free account
hub / github.com/codecombat/codecombat / getMembers

Function getMembers

app/core/api/classrooms.js:18–44  ·  view source on GitHub ↗
({ classroom }, options)

Source from the content-addressed store, hash-verified

16
17 // TODO: Set this up to allow using classroomID instead
18 getMembers ({ classroom }, options) {
19 const classroomID = classroom._id
20 const {
21 removeDeleted
22 } = options
23 delete options.removeDeleted
24 const limit = 10
25 let skip = 0
26 const size = _.size(classroom.members)
27 const url = `/db/classroom/${classroomID}/members`
28 if (options.data == null) { options.data = {} }
29 options.data.memberLimit = limit
30 options.remove = false
31 const jqxhrs = []
32 while (skip < size) {
33 options.data.memberSkip = skip
34 jqxhrs.push(fetchJson(url, options))
35 skip += limit
36 }
37 return Promise.all(jqxhrs).then(function (data) {
38 let users = _.flatten(data)
39 if (removeDeleted) {
40 users = _.filter(users, user => !user.deleted)
41 }
42 return users
43 })
44 },
45
46 getCourseLevels ({ classroomID, courseID }, options) {
47 if (options == null) { options = {} }

Callers

nothing calls this directly

Calls 1

filterMethod · 0.80

Tested by

no test coverage detected