Class: AvailableUsers

AvailableUsers

abstractnew AvailableUsers(args)

Manage a list of available users

All registered users can be "available" or "unavailable". Jobs can only be assigned to available users. Availability is calculated from two metrics: has the user set their state to "active", and have they moved the mouse in the past minute or so.
Name Type Description
args Object available users arguments
Example
var available_users = new AvailableUsers({
    bb: bb, // BulletinBoard object
    ss: ss, // SharedStore object
    language: 'en' // user will only be marked available for items in this language
});

Methods

active(val){Boolean}

getset a user's activity state

a user is deemed to be available if their state is set to "active" and they have moved the mouse in the past minute or so.
Name Type Description
val Boolean optional new activity state
Returns:
Type Description
Boolean activity state

is_ours(id){Boolean}

decide whether an element belongs to us based on an ID

Based on the list of users and their availability, decides whether this item should be assigned to us. This should assign items as stably as possible, even when users' availability changes.
Name Type Description
id Number Item ID
Returns:
Type Description
Boolean true if the item belongs to us