mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-12-14 01:31:15 -05:00
23 lines
666 B
CoffeeScript
23 lines
666 B
CoffeeScript
User = require 'models/User'
|
|
CocoCollection = require 'collections/CocoCollection'
|
|
|
|
module.exports = class Users extends CocoCollection
|
|
model: User
|
|
url: '/db/user'
|
|
|
|
fetchForClassroom: (classroom, options={}) ->
|
|
classroomID = classroom.id or classroom
|
|
limit = 10
|
|
skip = 0
|
|
size = _.size(classroom.get('members'))
|
|
options.url = "/db/classroom/#{classroomID}/members"
|
|
options.data ?= {}
|
|
options.data.memberLimit = limit
|
|
options.remove = false
|
|
jqxhrs = []
|
|
while skip < size
|
|
options = _.cloneDeep(options)
|
|
options.data.memberSkip = skip
|
|
jqxhrs.push(@fetch(options))
|
|
skip += limit
|
|
return jqxhrs
|