# Global

##

### Methods

#### addAdmin(user, callback)

Create a student USER, if the USER object is valid

##### Parameters:

Name | Type | Description
--- | --- | ---
`user` | object |
`callback` | function |

Source:
  - users.js, line 32

#### addAdmin(admin, callback)

add a user

##### Parameters:

Name | Type | Description
--- | --- | ---
`admin` | object |
`callback` | function |

Source:
  - db.js, line 83

#### addComment(questionId, userId, comment, callback)

add comment to question by id with user and comment

##### Parameters:

Name | Type | Description
--- | --- | ---
`questionId` | string |
`userId` | string |
`comment` | string |
`callback` | function |

Source:
  - questions.js, line 423

#### addFeedback(uuid, subject, message, callback)

Adds the user's feedback into the database

##### Parameters:

Name | Type | Description
--- | --- | ---
`uuid` | string |
`subject` | string |
`message` | string |
`callback` | funciton |

Source:
  - users.js, line 594

#### addQuestion(question, callback)

Insert a new question into the database. The question object passed to the function should have the text, topic, type, answer, minpoints, maxpoints and hint set.

##### Parameters:

Name | Type | Description
--- | --- | ---
`question` | object |
`callback` | function |

Source:
  - questions.js, line 130

#### addQuestion(question, callback)

Questions functions Add QUESTION to questionsCollection in the database

##### Parameters:

Name | Type | Description
--- | --- | ---
`question` | object |
`callback` | function |

Source:
  - db.js, line 491

#### addReply(commentId, userId, reply, callback)

add reply to comment by id with user and reply

##### Parameters:

Name | Type | Description
--- | --- | ---
`commentId` | string |
`userId` | string |
`reply` | string |
`callback` | function |

Source:
  - questions.js, line 455

#### addStudent(user, callback)

Create a student USER, if the USER object is valid

##### Parameters:

Name | Type | Description
--- | --- | ---
`user` | object |
`callback` | function |

Source:
  - users.js, line 87

#### addStudent(student, callback)

add a student

##### Parameters:

Name | Type | Description
--- | --- | ---
`student` | object |
`callback` | function |

Source:
  - db.js, line 73

#### addStudentAnalyticsWithDate(studentId, date, info, callback)

add student analytics if there are no records of the student, create a new record if there are recards of the student, get the last recard and compute the deltas

##### Parameters:

Name | Type | Description
--- | --- | ---
`studentId` | string |
`date` | string |
`info` | object |
`callback` | function |

Source:
  - db.js, line 858

#### addStudentAnalyticsWithDate(studentId, date, info, callback)

add student analytics if there are no records of the student, create a new record if there are recards of the student, get the last recard and compute the deltas

##### Parameters:

Name | Type | Description
--- | --- | ---
`studentId` | string |
`date` | string |
`info` | object |
`callback` | function |

Source:
  - analytics.js, line 320

#### addToVirtualFileSystem(callback)

add item to the virtual file system

##### Parameters:

Name | Type | Description
--- | --- | ---
`callback` | function |

Source:
  - db.js, line 948

#### addUser(user, callback)

add a user

##### Parameters:

Name | Type | Description
--- | --- | ---
`user` | object |
`callback` | function |

Source:
  - db.js, line 93

#### changeAllVisibility(changeValue, callback)

Changes visibilty of all questions based on the changeValue

##### Parameters:

Name | Type | Description
--- | --- | ---
`changeValue` | boolean |
`callback` | funciton |

Source:
  - questions.js, line 785

#### checkLogin(userId, pass, callback)

Check if the account given by user and pass is valid user type of null

##### Parameters:

Name | Type | Description
--- | --- | ---
`userId` | string |
`pass` | string |
`callback` | function |

Source:
  - db.js, line 201

#### checkLogin(username, pass, callback)

Check if the account given by user and pass is valid. Return account object if it is or null otherwise.

##### Parameters:

Name | Type | Description
--- | --- | ---
`username` | string |
`pass` | string |
`callback` | function |

Source:
  - users.js, line 241

#### chooseAllAttributeValidator(question) → {object}

choose all attribute validator

##### Parameters:

Name | Type | Description
--- | --- | ---
`question` | object |

Source:
  - questionValidator.js, line 218

##### Returns:

Type
  object

#### deleteQuestion(questionId, callback)

Deactivate the question with ID qid from the database.

##### Parameters:

Name | Type | Description
--- | --- | ---
`questionId` | string |
`callback` | function |

Source:
  - questions.js, line 198

#### error(text)

print an error message

##### Parameters:

Name | Type | Description
--- | --- | ---
`text` | string |

Source:
  - log.js, line 42

#### existsSync(fileId, callback)

check if a directory exists

##### Parameters:

Name | Type | Description
--- | --- | ---
`fileId` | string |
`callback` | function |

Source:
  - virtualFileSystem.js, line 91

#### findInVirtualFileSystem(callback)

find in the virtual file system

##### Parameters:

Name | Type | Description
--- | --- | ---
`callback` | function |

Source:
  - db.js, line 963

#### formatString() → {string}

formating a string based on an array of parts of the string

Source:
  - common.js, line 320

##### Returns:

Type
  string

#### getAccuracyOverTime(query, callback)

get accuracy of user over time

##### Parameters:

Name | Type | Description
--- | --- | ---
`query` | object |
`callback` | function |

Source:
  - analytics.js, line 1012

#### getAccuracyPerTopicVsClass(query, callback)

get accuracy per question topic

##### Parameters:

Name | Type | Description
--- | --- | ---
`query` | object |
`callback` | function |

Source:
  - analytics.js, line 1300

#### getAccuracyPerTypeVsClass(query, callback)

get accuracy per question type

##### Parameters:

Name | Type | Description
--- | --- | ---
`query` | object |
`callback` | function |

Source:
  - analytics.js, line 1438

#### getAccuracyRankOverTime(query, callback)

get accuracy rank over time

##### Parameters:

Name | Type | Description
--- | --- | ---
`query` | object |
`callback` | function |

Source:
  - analytics.js, line 1208

#### getAccuracyVsClass(query, callback)

get questions answered vs class

##### Parameters:

Name | Type | Description
--- | --- | ---
`query` | object |
`callback` | function |

Source:
  - analytics.js, line 440

#### getAdminById(adminId, callback)

get the admin object by Id if exists

##### Parameters:

Name | Type | Description
--- | --- | ---
`adminId` | string |
`callback` | function |

Source:
  - users.js, line 271

#### getAdminById(adminId, callback)

get admin by id

##### Parameters:

Name | Type | Description
--- | --- | ---
`adminId` | string |
`callback` | function |

Source:
  - db.js, line 277

#### getAdminsList(callback)

get admin list

##### Parameters:

Name | Type | Description
--- | --- | ---
`callback` | function |

Source:
  - db.js, line 115

#### getAdminsList(callback)

Return an array of users in the database.

##### Parameters:

Name | Type | Description
--- | --- | ---
`callback` | function |

Source:
  - users.js, line 186

#### getAllQuestionsByQuery(findQuery, sortQuery, callback)

get all questions list by Query

##### Parameters:

Name | Type | Description
--- | --- | ---
`findQuery` | object |
`sortQuery` | object |
`callback` | function |

Source:
  - questions.js, line 281

#### getAllQuestionsList(callback)

get all questions list

##### Parameters:

Name | Type | Description
--- | --- | ---
`callback` | function |

Source:
  - questions.js, line 270

#### getAllSettings(callback)

get all settings object from database

##### Parameters:

Name | Type | Description
--- | --- | ---
`callback` | function |

Source:
  - settings.js, line 353

#### getAllSettings(callback)

get all settings objects from the collection

##### Parameters:

Name | Type | Description
--- | --- | ---
`callback` | function |

Source:
  - db.js, line 804

#### getAllSettings(callback)

get all settings object

##### Parameters:

Name | Type | Description
--- | --- | ---
`callback` | function |

Source:
  - settings.js, line 344

#### getAllSettings(callback)

get all settings objects from the collection

##### Parameters:

Name | Type | Description
--- | --- | ---
`callback` | function |

Source:
  - db.js, line 813

#### getAnalytics(callback)

get analytics for a admins

##### Parameters:

Name | Type | Description
--- | --- | ---
`callback` | function |

Source:
  - analytics.js, line 153

#### getAttemptRankOverTime(query, callback)

get attempt rank over time

##### Parameters:

Name | Type | Description
--- | --- | ---
`query` | object |
`callback` | function |

Source:
  - analytics.js, line 1152

#### getAverageRating(ratingsList)

get average rating

##### Parameters:

Name | Type | Description
--- | --- | ---
`ratingsList` | list |

Source:
  - analytics.js, line 549

#### getChart(query, callback)

get the charts based on type

##### Parameters:

Name | Type | Description
--- | --- | ---
`query` | object |
`callback` | function |

Source:
  - analytics.js, line 67

#### getClassAccuracy(query, callback)

get accuracy of the class

##### Parameters:

Name | Type | Description
--- | --- | ---
`query` | object |
`callback` | function |

Source:
  - analytics.js, line 794

#### getClassAccuracyOverTime(query, callback)

get accuracy of the class over time

##### Parameters:

Name | Type | Description
--- | --- | ---
`query` | object |
`callback` | function |

Source:
  - analytics.js, line 740

#### getClassAccuracyPerTopicVsClass(query, callback)

get class accuracy per question topic

##### Parameters:

Name | Type | Description
--- | --- | ---
`query` | object |
`callback` | function |

Source:
  - analytics.js, line 1564

#### getClassAccuracyPerTypeVsClass(query, callback)

get class accuracy per question type

##### Parameters:

Name | Type | Description
--- | --- | ---
`query` | object |
`callback` | function |

Source:
  - analytics.js, line 1822

#### getClassActive(callback)

check if the class is active

##### Parameters:

Name | Type | Description
--- | --- | ---
`callback` | funtion |

Source:
  - settings.js, line 45

#### getClassAnswered(query, callback)

get questions answered of the class

##### Parameters:

Name | Type | Description
--- | --- | ---
`query` | object |
`callback` | function |

Source:
  - analytics.js, line 565

#### getClassAnsweredOverTime(query, callback)

get questions answered of the class over time

##### Parameters:

Name | Type | Description
--- | --- | ---
`query` | object |
`callback` | function |

Source:
  - analytics.js, line 659

#### getClassOverall(query, callback)

get overall value of the class

##### Parameters:

Name | Type | Description
--- | --- | ---
`query` | object |
`callback` | function |

Source:
  - analytics.js, line 625

#### getClassOverallOverTime(query, callback)

get overall average of the class over time

##### Parameters:

Name | Type | Description
--- | --- | ---
`query` | object |
`callback` | function |

Source:
  - analytics.js, line 686

#### getClassPoints(query, callback)

get points of the class

##### Parameters:

Name | Type | Description
--- | --- | ---
`query` | object |
`callback` | function |

Source:
  - analytics.js, line 824

#### getClassPointsOverTime(query, callback)

get points of the class over time

##### Parameters:

Name | Type | Description
--- | --- | ---
`query` | object |
`callback` | function |

Source:
  - analytics.js, line 767

#### getClassPointsPerAttempt(query, callback)

get class points per attempt of the class

##### Parameters:

Name | Type | Description
--- | --- | ---
`query` | object |
`callback` | function |

Source:
  - analytics.js, line 595

#### getClassPointsPerAttemptOverTime(query, callback)

get points per attempt average of the class over time

##### Parameters:

Name | Type | Description
--- | --- | ---
`query` | object |
`callback` | function |

Source:
  - analytics.js, line 713

#### getClassPointsPerTopicVsClass(query, callback)

get class points per question topic

##### Parameters:

Name | Type | Description
--- | --- | ---
`query` | object |
`callback` | function |

Source:
  - analytics.js, line 1512

#### getClassPointsPerTypeVsClass(query, callback)

get class points per question type

##### Parameters:

Name | Type | Description
--- | --- | ---
`query` | object |
`callback` | function |

Source:
  - analytics.js, line 1770

#### getClassRating(query, callback)

get rating of the class

##### Parameters:

Name | Type | Description
--- | --- | ---
`query` | object |
`callback` | function |

Source:
  - analytics.js, line 854

#### getClassRatingPerTopicVsClass(query, callback)

get class rating per topic vs class

##### Parameters:

Name | Type | Description
--- | --- | ---
`query` | object |
`callback` | function |

Source:
  - analytics.js, line 1614

#### getClassRatingPerTypeVsClass(query, callback)

get class rating per type vs class

##### Parameters:

Name | Type | Description
--- | --- | ---
`query` | object |
`callback` | function |

Source:
  - analytics.js, line 1692

#### getCorrectAttemptRankOverTime(query, callback)

get correct attempt rank over time

##### Parameters:

Name | Type | Description
--- | --- | ---
`query` | object |
`callback` | function |

Source:
  - analytics.js, line 1180

#### getCorrectAttemptsOverTime(query, callback)

get number correct attempts of user over time

##### Parameters:

Name | Type | Description
--- | --- | ---
`query` | object |
`callback` | function |

Source:
  - analytics.js, line 886

#### getDate() → {string}

return the current date

Source:
  - common.js, line 230

##### Returns:

Type
  string

#### getDateByFormat() → {string}

return the current date with format

Source:
  - common.js, line 290

##### Returns:

Type
  string

#### getDateFormatedMinutesAgo(mins, format) → {string}

return the current date

##### Parameters:

Name | Type | Description
--- | --- | ---
`mins` | number |
`format` | string |

Source:
  - common.js, line 252

##### Returns:

Type
  string

#### getDateObject() → {date}

return the current date

Source:
  - common.js, line 240

##### Returns:

Type
  date

#### getDiscussionboardDislikesEnabled(callback)

get discussionboard dislikes enabled

##### Parameters:

Name | Type | Description
--- | --- | ---
`callback` | funtion |

Source:
  - settings.js, line 321

#### getDiscussionboardVisibilityEnabled(callback)

get discussionboard visibility enabled

##### Parameters:

Name | Type | Description
--- | --- | ---
`callback` | funtion |

Source:
  - settings.js, line 298

#### getError(errorCode) → {object}

return an object of error code and message

##### Parameters:

Name | Type | Description
--- | --- | ---
`errorCode` | number |

Source:
  - common.js, line 157

##### Returns:

Type
  object

#### getFeedback(callback)

Get all the feedback stored in the collection

##### Parameters:

Name | Type | Description
--- | --- | ---
`callback` | function |

Source:
  - users.js, line 622

#### getFullLeaderboard(callback)

Fetch a list of students to display in the leaderboard.

##### Parameters:

Name | Type | Description
--- | --- | ---
`callback` | function |

Source:
  - users.js, line 554

#### getIdsListFromJSONList() → {array}

given a list of JSON objects that have Id as one of their feilds, return a list of Ids

Source:
  - common.js, line 189

##### Returns:

Type
  array

#### getLeaderboard(userid, smallBoard, callback)

Fetch a list of students to display in the leaderboard. If smallBoard is true, return points leaderboard with top 3 entries.

##### Parameters:

Name | Type | Description
--- | --- | ---
`userid` | string |
`smallBoard` | boolean |
`callback` | function |

Source:
  - users.js, line 466

#### getLeaderboardLimit(callback)

get the limit of rows on the leaderboard

##### Parameters:

Name | Type | Description
--- | --- | ---
`callback` | funtion |

Source:
  - settings.js, line 91

#### getLeaderboardLimited(callback)

get the true of false if the leader board is set to a limit

##### Parameters:

Name | Type | Description
--- | --- | ---
`callback` | funtion |

Source:
  - settings.js, line 68

#### getNextQuestionNumber(callback)

get next question number

##### Parameters:

Name | Type | Description
--- | --- | ---
`callback` | function |

Source:
  - db.js, line 527

#### getOverallOverTime(query, callback)

get points per attempts of user and class over time

##### Parameters:

Name | Type | Description
--- | --- | ---
`query` | object |
`callback` | function |

Source:
  - analytics.js, line 970

#### getOverallRankOverTime(query, callback)

get overall rank over time

##### Parameters:

Name | Type | Description
--- | --- | ---
`query` | object |
`callback` | function |

Source:
  - analytics.js, line 1096

#### getOverallVsClass(query, callback)

get questions answered vs class

##### Parameters:

Name | Type | Description
--- | --- | ---
`query` | object |
`callback` | function |

Source:
  - analytics.js, line 376

#### getPointsOverTime(query, callback)

get points of user over time

##### Parameters:

Name | Type | Description
--- | --- | ---
`query` | object |
`callback` | function |

Source:
  - analytics.js, line 1054

#### getPointsPerAttemptsOverTime(query, callback)

get points per attempts of user and class over time

##### Parameters:

Name | Type | Description
--- | --- | ---
`query` | object |
`callback` | function |

Source:
  - analytics.js, line 928

#### getPointsPerAttemptVsClass(query, callback)

get questions answered vs class

##### Parameters:

Name | Type | Description
--- | --- | ---
`query` | object |
`callback` | function |

Source:
  - analytics.js, line 408

#### getPointsPerTopicVsClass(query, callback)

get points per question topic

##### Parameters:

Name | Type | Description
--- | --- | ---
`query` | object |
`callback` | function |

Source:
  - analytics.js, line 1236

#### getPointsPerTypeVsClass(query, callback)

get points per question type

##### Parameters:

Name | Type | Description
--- | --- | ---
`query` | object |
`callback` | function |

Source:
  - analytics.js, line 1374

#### getPointsRankOverTime(query, callback)

get points rank over time

##### Parameters:

Name | Type | Description
--- | --- | ---
`query` | object |
`callback` | function |

Source:
  - analytics.js, line 1124

#### getPointsVsClass(query, callback)

get points vs class

##### Parameters:

Name | Type | Description
--- | --- | ---
`query` | object |
`callback` | function |

Source:
  - analytics.js, line 476

#### getQuestionDefaultMaxPoints(callback)

get question default max points

##### Parameters:

Name | Type | Description
--- | --- | ---
`callback` | funtion |

Source:
  - settings.js, line 229

#### getQuestionDefaultMinPoints(callback)

get question default min points

##### Parameters:

Name | Type | Description
--- | --- | ---
`callback` | funtion |

Source:
  - settings.js, line 206

#### getQuestionDefaultTopic(callback)

get question default topic

##### Parameters:

Name | Type | Description
--- | --- | ---
`callback` | funtion |

Source:
  - settings.js, line 183

#### getQuestionsAnsweredVsClass(query, callback)

get questions answered vs class

##### Parameters:

Name | Type | Description
--- | --- | ---
`query` | object |
`callback` | function |

Source:
  - analytics.js, line 340

#### getQuestionsList(findQuery, sortQuery, callback)

get the list of Active questions sorted

##### Parameters:

Name | Type | Description
--- | --- | ---
`findQuery` | object |
`sortQuery` | object |
`callback` | function |

Source:
  - db.js, line 546

#### getQuestionsListByUser(request, callback)

Fetch the question list of userId

##### Parameters:

Name | Type | Description
--- | --- | ---
`request` | object |
`callback` | function |

Source:
  - users.js, line 352

#### getQuestionsListforAdmin(findQuery, sortQuery, callback)

get the list of questions sorted

##### Parameters:

Name | Type | Description
--- | --- | ---
`findQuery` | object |
`sortQuery` | object |
`callback` | function |

Source:
  - db.js, line 569

#### getQuestionTimeoutEnabled(callback)

get question timeout enabled

##### Parameters:

Name | Type | Description
--- | --- | ---
`callback` | funtion |

Source:
  - settings.js, line 252

#### getQuestionTimeoutPeriod(callback)

get question timeout period

##### Parameters:

Name | Type | Description
--- | --- | ---
`callback` | funtion |

Source:
  - settings.js, line 275

#### getRatingVsClass(query, callback)

get rating vs class

##### Parameters:

Name | Type | Description
--- | --- | ---
`query` | object |
`callback` | function |

Source:
  - analytics.js, line 512

#### getStudentById(studentId, callback)

get the admin object by Id if exists

##### Parameters:

Name | Type | Description
--- | --- | ---
`studentId` | string |
`callback` | function |

Source:
  - users.js, line 261

#### getStudentById(studentId, callback)

get student by id

##### Parameters:

Name | Type | Description
--- | --- | ---
`studentId` | string |
`callback` | function |

Source:
  - db.js, line 267

#### getStudentEditEmailEnabled(callback)

check if the student can edit their email

##### Parameters:

Name | Type | Description
--- | --- | ---
`callback` | funtion |

Source:
  - settings.js, line 137

#### getStudentEditNameEnabled(callback)

check if the student can edit their first and last name

##### Parameters:

Name | Type | Description
--- | --- | ---
`callback` | funtion |

Source:
  - settings.js, line 114

#### getStudentEditPasswordEnabled(callback)

check if the student can edit their password

##### Parameters:

Name | Type | Description
--- | --- | ---
`callback` | funtion |

Source:
  - settings.js, line 160

#### getStudentsList(callback)

get student list

##### Parameters:

Name | Type | Description
--- | --- | ---
`callback` | function |

Source:
  - db.js, line 124

#### getStudentsList(callback)

get students list

##### Parameters:

Name | Type | Description
--- | --- | ---
`callback` | function |

Source:
  - users.js, line 196

#### getStudentsListSorted(lim, callback)

Return an array of users in the database, sorted by rank.

##### Parameters:

Name | Type | Description
--- | --- | ---
`lim` | int |
`callback` | function |

Source:
  - users.js, line 228

#### getStudentsListSorted(lim, callback)

get students list sorted

##### Parameters:

Name | Type | Description
--- | --- | ---
`lim` | int |
`callback` | function |

Source:
  - db.js, line 170

#### getStudentsListWithStatus(status, callback)

get students list with status

##### Parameters:

Name | Type | Description
--- | --- | ---
`status` | string |
`callback` | function |

Source:
  - db.js, line 143

#### getStudentsListWithStatus(active, callback)

get students list with status

##### Parameters:

Name | Type | Description
--- | --- | ---
`active` | boolean |
`callback` | function |

Source:
  - users.js, line 207

#### getTime() → {string}

return the time in "<0> days, <0> hours, <0> minutes, <0> seconds" format

Source:
  - common.js, line 262

##### Returns:

Type
  string

#### getTimeBasedAnalytics(findQuery, callback)

get the list of data on the user by date

##### Parameters:

Name | Type | Description
--- | --- | ---
`findQuery` | object |
`callback` | function |

Source:
  - analytics.js, line 330

#### getUserById(userId, callback)

get user by id

##### Parameters:

Name | Type | Description
--- | --- | ---
`userId` | string |
`callback` | function |

Source:
  - db.js, line 189

#### getUserById(userId, callback)

get user by id

##### Parameters:

Name | Type | Description
--- | --- | ---
`userId` | string |
`callback` | function |

Source:
  - db.js, line 287

#### getUserById(userId, callback)

Fetch the user object with ID iserId in the users database.

##### Parameters:

Name | Type | Description
--- | --- | ---
`userId` | string |
`callback` | function |

Source:
  - users.js, line 251

#### getUserByUsername(adminId, callback)

get the user object by username if exists

##### Parameters:

Name | Type | Description
--- | --- | ---
`adminId` | string |
`callback` | function |

Source:
  - users.js, line 281

#### getUserObject(findQuery, callback)

get user by search query

##### Parameters:

Name | Type | Description
--- | --- | ---
`findQuery` | object |
`callback` | function |

Source:
  - db.js, line 297

#### getUsersList(callback)

get users list

##### Parameters:

Name | Type | Description
--- | --- | ---
`callback` | function |

Source:
  - users.js, line 217

#### getUsersList(findQuery, sortQuery, callback)

Return an array of users in the database, sorted by rank

##### Parameters:

Name | Type | Description
--- | --- | ---
`findQuery` | object |
`sortQuery` | object |
`callback` | function |

Source:
  - db.js, line 154

#### getUsersList(callback)

get users list

##### Parameters:

Name | Type | Description
--- | --- | ---
`callback` | function |

Source:
  - db.js, line 133

#### getUUID() → {string}

get a unique Id

Source:
  - common.js, line 300

##### Returns:

Type
  string

#### getVariableType(variable)

get variable type

##### Parameters:

Name | Type | Description
--- | --- | ---
`variable` | * |

Source:
  - common.js, line 310

#### init()

initiate the logging with file

Source:
  - log.js, line 52

#### initialize()

Initialize allSettings object

Source:
  - settings.js, line 468

#### initialize(callback)

Open a connection to the database

##### Parameters:

Name | Type | Description
--- | --- | ---
`callback` | function |

Source:
  - db.js, line 45

#### initialize(callback)

start the analytics daily process

##### Parameters:

Name | Type | Description
--- | --- | ---
`callback` | function |

Source:
  - analytics.js, line 35

#### isEmptyObject() → {boolean}

check if json obejct is empty

Source:
  - common.js, line 215

##### Returns:

Type
  boolean

#### isKeyValuePairInJsonList(list, field, value) → {boolean}

Returns a JSON from a list of JSONs given a key, value to search for

##### Parameters:

Name | Type | Description
--- | --- | ---
`list` | list |
`field` | string |
`value` | string |

Source:
  - common.js, line 347

##### Returns:

Type
  boolean

#### isUserLocked(userId, question, callback)

check if the user is locked from answering the question

##### Parameters:

Name | Type | Description
--- | --- | ---
`userId` | string |
`question` | object |
`callback` | function |

Source:
  - questions.js, line 706

#### log(text)

print a normal message

##### Parameters:

Name | Type | Description
--- | --- | ---
`text` | string |

Source:
  - log.js, line 30

#### lookupQuestion(findQuery, callback)

Extract a question object from the database using its ID

##### Parameters:

Name | Type | Description
--- | --- | ---
`findQuery` | object |
`callback` | function |

Source:
  - db.js, line 589

#### lookupQuestionById(questionId, callback)

lookup question in database

##### Parameters:

Name | Type | Description
--- | --- | ---
`questionId` | string |
`callback` | function |

Source:
  - questions.js, line 236

#### lookupQuestionById(questionId, callback)

Extract a question object from the database using its ID.

##### Parameters:

Name | Type | Description
--- | --- | ---
`questionId` | string |
`callback` | function |

Source:
  - questions.js, line 226

#### matchingAttributeValidator(question) → {object}

matching attribute validator

##### Parameters:

Name | Type | Description
--- | --- | ---
`question` | object |

Source:
  - questionValidator.js, line 199

##### Returns:

Type
  object

#### mkdir(parentPath, directoryName, directoryPermissions, callback)

make a directory given the path and the name of the new directory

##### Parameters:

Name | Type | Description
--- | --- | ---
`parentPath` | string |
`directoryName` | string |
`directoryPermissions` | string |
`callback` | function |

Source:
  - virtualFileSystem.js, line 34

#### multipleChoiceAttributeValidator(question) → {object}

multiple choice attribute validator

##### Parameters:

Name | Type | Description
--- | --- | ---
`question` | object |

Source:
  - questionValidator.js, line 164

##### Returns:

Type
  object

#### orderingAttributeValidator(question) → {object}

ordering attribute validator

##### Parameters:

Name | Type | Description
--- | --- | ---
`question` | object |

Source:
  - questionValidator.js, line 241

##### Returns:

Type
  object

#### prepareQuestionData(question, callback)

Prepare question data on first pass to DB

##### Parameters:

Name | Type | Description
--- | --- | ---
`question` | object |
`callback` | function |

Source:
  - questions.js, line 55

#### qTypeFailMsg(message) → {object}

Send back specific error message by question type

##### Parameters:

Name | Type | Description
--- | --- | ---
`message` | string |

Source:
  - questionValidator.js, line 30

##### Returns:

Type
  object

#### questionCreationValidation(info) → {object}

Validate all question fields on first entry to db

##### Parameters:

Name | Type | Description
--- | --- | ---
`info` | object |

Source:
  - questionValidator.js, line 40

##### Returns:

Type
  object

#### questionUpdateParser(question)

Preparing data on update/edit of a question

##### Parameters:

Name | Type | Description
--- | --- | ---
`question` | object |

Source:
  - questions.js, line 31

#### randomizeList() → {array}

shuffle the given list and return the result as a new list

Source:
  - common.js, line 170

##### Returns:

Type
  array

#### regexAttributeValidator(question) → {object}

regex attribute validator

##### Parameters:

Name | Type | Description
--- | --- | ---
`question` | object |

Source:
  - questionValidator.js, line 151

##### Returns:

Type
  object

#### removeAllQuestions(callback)

cleanup the users collection

##### Parameters:

Name | Type | Description
--- | --- | ---
`callback` | function |

Source:
  - db.js, line 508

#### removeAllUsers(callback)

cleanup the users collection

##### Parameters:

Name | Type | Description
--- | --- | ---
`callback` | function |

Source:
  - db.js, line 249

#### removeAnalytics(callback)

remove all previous analytics

##### Parameters:

Name | Type | Description
--- | --- | ---
`callback` | function |

Source:
  - db.js, line 836

#### removeAnalytics(callback)

clean all previous analytics data

##### Parameters:

Name | Type | Description
--- | --- | ---
`callback` | function |

Source:
  - analytics.js, line 306

#### removeVirtualFileSystem(callback)

clean up the virtual file system

##### Parameters:

Name | Type | Description
--- | --- | ---
`callback` | function |

Source:
  - virtualFileSystem.js, line 140

#### removeVirtualFileSystem(callback)

clean up the virtual file system

##### Parameters:

Name | Type | Description
--- | --- | ---
`callback` | function |

Source:
  - db.js, line 932

#### resetAllSettings(callback)

reset the global settings to their default values

##### Parameters:

Name | Type | Description
--- | --- | ---
`callback` | function |

Source:
  - settings.js, line 30

#### resetAllSettings(callback)

reset all settings to default

##### Parameters:

Name | Type | Description
--- | --- | ---
`callback` | function |

Source:
  - db.js, line 758

#### resetAllSettings(callback)

reset all settings to default

##### Parameters:

Name | Type | Description
--- | --- | ---
`callback` | function |

Source:
  - db.js, line 749

#### rmdir(parentPath, directoryName, callback)

BE CAREFUL: remove a directory given the path and the name of the new directory

##### Parameters:

Name | Type | Description
--- | --- | ---
`parentPath` | string |
`directoryName` | string |
`callback` | function |

Source:
  - virtualFileSystem.js, line 62

#### rmrf(parentPath, directoryName, callback)

BE CAREFUL: perform rm -rf on a directory

##### Parameters:

Name | Type | Description
--- | --- | ---
`parentPath` | string |
`directoryName` | string |
`callback` | function |

Source:
  - virtualFileSystem.js, line 77

#### setClassActive(isActive, callback)

set class activation status

##### Parameters:

Name | Type | Description
--- | --- | ---
`isActive` | boolean |
`callback` | funtion |

Source:
  - settings.js, line 55

#### setDiscussionboardDislikesEnabled(isActive, callback)

set discussionboard dislikes enabled

##### Parameters:

Name | Type | Description
--- | --- | ---
`isActive` | boolean |
`callback` | funtion |

Source:
  - settings.js, line 331

#### setDiscussionboardVisibilityEnabled(isActive, callback)

set discussionboard visibility enabled

##### Parameters:

Name | Type | Description
--- | --- | ---
`isActive` | boolean |
`callback` | funtion |

Source:
  - settings.js, line 308

#### setLeaderboardLimit(limit, callback)

set leaderboard limit

##### Parameters:

Name | Type | Description
--- | --- | ---
`limit` | number |
`callback` | funtion |

Source:
  - settings.js, line 101

#### setLeaderboardLimited(limit, callback)

set leaderboard limit

##### Parameters:

Name | Type | Description
--- | --- | ---
`limit` | number |
`callback` | funtion |

Source:
  - settings.js, line 78

#### setQuestionDefaultMinPoints(points, callback)

get question default min points

##### Parameters:

Name | Type | Description
--- | --- | ---
`points` | number |
`callback` | funtion |

Source:
  - settings.js, line 216

#### setQuestionDefaultMinPoints(points, callback)

get question default max points

##### Parameters:

Name | Type | Description
--- | --- | ---
`points` | number |
`callback` | funtion |

Source:
  - settings.js, line 239

#### setQuestionDefaultTopic(topic, callback)

set question default topic

##### Parameters:

Name | Type | Description
--- | --- | ---
`topic` | string |
`callback` | funtion |

Source:
  - settings.js, line 193

#### setQuestionTimeoutEnabled(isActive, callback)

set question timeout enabled

##### Parameters:

Name | Type | Description
--- | --- | ---
`isActive` | boolean |
`callback` | funtion |

Source:
  - settings.js, line 262

#### setQuestionTimeoutPeriod(timeout, callback)

set question timeout period

##### Parameters:

Name | Type | Description
--- | --- | ---
`timeout` | number |
`callback` | funtion |

Source:
  - settings.js, line 285

#### setStudentEditEmailEnabled(isActive, callback)

set student edit email enabled

##### Parameters:

Name | Type | Description
--- | --- | ---
`isActive` | boolean |
`callback` | funtion |

Source:
  - settings.js, line 147

#### setStudentEditNameEnabled(isActive, callback)

set student edit name enabled

##### Parameters:

Name | Type | Description
--- | --- | ---
`isActive` | boolean |
`callback` | funtion |

Source:
  - settings.js, line 124

#### setStudentEditPasswordEnabled(isActive, callback)

set student edit password enabled

##### Parameters:

Name | Type | Description
--- | --- | ---
`isActive` | boolean |
`callback` | funtion |

Source:
  - settings.js, line 170

#### setUserStatus(studentId, newStatus, callback)

set the status of the user to active or in-active

##### Parameters:

Name | Type | Description
--- | --- | ---
`studentId` | string |
`newStatus` | boolean |
`callback` | function |

Source:
  - users.js, line 404

#### sortLeaderBoard(list, criteria)

sort leaderboard based on criteria

##### Parameters:

Name | Type | Description
--- | --- | ---
`list` | list |
`criteria` | string |

Source:
  - analytics.js, line 295

#### submitAnswer(userId, questionId, correct, points, answer, callback)

submit user's answer on a question by updating the collections

##### Parameters:

Name | Type | Description
--- | --- | ---
`userId` | string |
`questionId` | string |
`correct` | boolean |
`points` | int |
`answer` | string |
`callback` | function |

Source:
  - users.js, line 295

#### submitAnswer(questionId, userId, correct, points, answer, callback)

submit answer

##### Parameters:

Name | Type | Description
--- | --- | ---
`questionId` | string |
`userId` | string |
`correct` | boolean |
`points` | number |
`answer` | * |
`callback` | function |

Source:
  - questions.js, line 295

#### submitRating(questionId, userId, rating, callback)

adding rating to question collection

##### Parameters:

Name | Type | Description
--- | --- | ---
`questionId` | string |
`userId` | string |
`rating` | number |
`callback` | function |

Source:
  - questions.js, line 248

#### submitRating(userId, questionId, rating, callback)

adding rating to question collection

##### Parameters:

Name | Type | Description
--- | --- | ---
`userId` | string |
`questionId` | string |
`rating` | int |
`callback` | function |

Source:
  - users.js, line 416

#### sumListOfNumbers(list)

return a number as the sum of all numbers in a list

##### Parameters:

Name | Type | Description
--- | --- | ---
`list` | list |

Source:
  - common.js, line 203

#### trueAndFalseAttributeValidator(question) → {object}

true and false attribute validator

##### Parameters:

Name | Type | Description
--- | --- | ---
`question` | object |

Source:
  - questionValidator.js, line 183

##### Returns:

Type
  object

#### updateAdminById(userId, info, callback)

update admin by id

##### Parameters:

Name | Type | Description
--- | --- | ---
`userId` | string |
`info` | object |
`callback` | function |

Source:
  - db.js, line 338

#### updateAdminById(userId, info, callback)

update admin by id

##### Parameters:

Name | Type | Description
--- | --- | ---
`userId` | string |
`info` | object |
`callback` | function |

Source:
  - users.js, line 177

#### updateProfile(userId, request, callback)

update user's profile based on the given infomation

##### Parameters:

Name | Type | Description
--- | --- | ---
`userId` | string |
`request` | object |
`callback` | function |

Source:
  - users.js, line 427

#### updateQuestionById(questionId, request, callback)

update a question record based on its id

##### Parameters:

Name | Type | Description
--- | --- | ---
`questionId` | string |
`request` | object |
`callback` | function |

Source:
  - db.js, line 614

#### updateQuestionById(questionId, info, callback)

Replace a question in the database with the provided question object.

##### Parameters:

Name | Type | Description
--- | --- | ---
`questionId` | string |
`info` | object |
`callback` | function |

Source:
  - questions.js, line 174

#### updateQuestionById(questionId, info, callback)

Replace a question in the database with the provided question object.

##### Parameters:

Name | Type | Description
--- | --- | ---
`questionId` | string |
`info` | object |
`callback` | function |

Source:
  - questions.js, line 163

#### updateQuestionByQuery(query, update, callback)

update users collection directly by a query

##### Parameters:

Name | Type | Description
--- | --- | ---
`query` | object |
`update` | object |
`callback` | function |

Source:
  - db.js, line 705

#### updateSettings(updateObject, callback)

update multiple settings based on the passed params

##### Parameters:

Name | Type | Description
--- | --- | ---
`updateObject` | object |
`callback` | function |

Source:
  - settings.js, line 365

#### updateSettings(updateQuery, callback)

update settings object

##### Parameters:

Name | Type | Description
--- | --- | ---
`updateQuery` | object |
`callback` | function |

Source:
  - settings.js, line 460

#### updateSettings(findQuery, updateQuery, callback)

update settings object

##### Parameters:

Name | Type | Description
--- | --- | ---
`findQuery` | object |
`updateQuery` | object |
`callback` | function |

Source:
  - db.js, line 923

#### updateStudentById(userId, info, callback)

update student by id

##### Parameters:

Name | Type | Description
--- | --- | ---
`userId` | string |
`info` | object |
`callback` | function |

Source:
  - users.js, line 166

#### updateStudentById(userId, info, callback)

update student by id

##### Parameters:

Name | Type | Description
--- | --- | ---
`userId` | string |
`info` | object |
`callback` | function |

Source:
  - db.js, line 327

#### updateUserById(userId, info, callback)

update user by id

##### Parameters:

Name | Type | Description
--- | --- | ---
`userId` | string |
`info` | object |
`callback` | function |

Source:
  - db.js, line 349

#### updateUserById(userId, info, callback)

Update the account with ID userid in the student database. The user argument holds the complete new object to insert. Fail if the ID has changed and the new ID already belongs to a user.

##### Parameters:

Name | Type | Description
--- | --- | ---
`userId` | string |
`info` | object |
`callback` | function |

Source:
  - users.js, line 155

#### updateUserById(userId, info, callback)

update user by id

##### Parameters:

Name | Type | Description
--- | --- | ---
`userId` | string |
`info` | object |
`callback` | function |

Source:
  - db.js, line 316

#### updateUserByQuery(query, update, callback)

update users collection directly by a query

##### Parameters:

Name | Type | Description
--- | --- | ---
`query` | object |
`update` | object |
`callback` | function |

Source:
  - db.js, line 478

#### updateUserPassword(query, update, password, callback)

update user password

##### Parameters:

Name | Type | Description
--- | --- | ---
`query` | object |
`update` | object |
`password` | string |
`callback` | function |

Source:
  - db.js, line 435

#### updateUserPassword(query, update, password, callback)

update user password

##### Parameters:

Name | Type | Description
--- | --- | ---
`query` | object |
`update` | object |
`password` | string |
`callback` | function |

Source:
  - db.js, line 447

#### updateUserSubmissionTime(userId, question, callback)

Updates the Users Submission time for a Question

##### Parameters:

Name | Type | Description
--- | --- | ---
`userId` | string |
`question` | object |
`callback` | function |

Source:
  - questions.js, line 745

#### validateAllAttributesInGroup(objectToCheck, attributeType) → {boolean}

Validate all attributes in Object being passed and has correct field types

##### Parameters:

Name | Type | Description
--- | --- | ---
`objectToCheck` | object |
`attributeType` | string |

Source:
  - questionValidator.js, line 274

##### Returns:

Type
  boolean

#### validateArrayObject(arrayObject, typeOfvalue) → {boolean}

Validate an Array object to contain specific value types

##### Parameters:

Name | Type | Description
--- | --- | ---
`arrayObject` | list |
`typeOfvalue` | string |

Source:
  - questionValidator.js, line 290

##### Returns:

Type
  boolean

#### validateAttributeFields(question, type) → {object}

Validate all fields that will be modified

##### Parameters:

Name | Type | Description
--- | --- | ---
`question` | object |
`type` | string |

Source:
  - questionValidator.js, line 77

##### Returns:

Type
  object

#### validateAttributeType(valueToCheck, key, attributeType) → {boolean}

Validate specific value to it's attributeType in DB

##### Parameters:

Name | Type | Description
--- | --- | ---
`valueToCheck` | * |
`key` | string |
`attributeType` | string |

Source:
  - questionValidator.js, line 262

##### Returns:

Type
  boolean

#### validateDefaultQuestionValues(questionData) → {object}

validate default question values

##### Parameters:

Name | Type | Description
--- | --- | ---
`questionData` | number |

Source:
  - questionValidator.js, line 59

##### Returns:

Type
  object

#### validatePassword(userobj, pass, callback)

Check the hash of pass against the password stored in userobj

##### Parameters:

Name | Type | Description
--- | --- | ---
`userobj` | object |
`pass` | string |
`callback` | function |

Source:
  - db.js, line 238

#### validateQuestionAttributesByType(question, type) → {object}

validate question attributes by type

##### Parameters:

Name | Type | Description
--- | --- | ---
`question` | object |
`type` | string |

Source:
  - questionValidator.js, line 112

##### Returns:

Type
  object

#### verifyAnswer(question, answer)

verify answer based on type

##### Parameters:

Name | Type | Description
--- | --- | ---
`question` | object |
`answer` | * |

Source:
  - questions.js, line 338

#### verifyChooseAllQuestionAnswer(question, answer)

verify choose all question answer

##### Parameters:

Name | Type | Description
--- | --- | ---
`question` | object |
`answer` | * |

Source:
  - questions.js, line 360

#### verifyMatchingQuestionAnswer(question, answer)

verify matching question answer

##### Parameters:

Name | Type | Description
--- | --- | ---
`question` | object |
`answer` | * |

Source:
  - questions.js, line 374

#### verifyOrderingQuestionAnswer(question, answer)

Check if answer submitted is correct for Ordering question Type

##### Parameters:

Name | Type | Description
--- | --- | ---
`question` | object |
`answer` | * |

Source:
  - questions.js, line 407

#### voteComment(commentId, vote, userId, callback)

vote on a comment The way votes work: if the user already voted up, then if they vote up again the previous vote will get cancelled. Same for vote down. if the user already voted up, then vote down the previous vote gets removed and the new vote gets added. if they never voted before, just add the vote

##### Parameters:

Name | Type | Description
--- | --- | ---
`commentId` | string |
`vote` | number |
`userId` | string |
`callback` | function |

Source:
  - questions.js, line 494

#### voteReply(replyId, vote, userId, callback)

vote on a reply

##### Parameters:

Name | Type | Description
--- | --- | ---
`replyId` | string |
`vote` | number |
`userId` | string |
`callback` | function |

Source:
  - questions.js, line 587

#### writeFile(fileObj, callback)

write data to a fils

##### Parameters:

Name | Type | Description
--- | --- | ---
`fileObj` | object |
`callback` | function |

Source:
  - virtualFileSystem.js, line 109