Global

Methods

addAdmin(user, callback)

Create a student USER, if the USER object is valid
Parameters:
Name Type Description
user object
callback function
Source:

addAdmin(admin, callback)

add a user
Parameters:
Name Type Description
admin object
callback function
Source:

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:

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:

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:

addQuestion(question, callback)

Questions functions Add QUESTION to questionsCollection in the database
Parameters:
Name Type Description
question object
callback function
Source:

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:

addStudent(user, callback)

Create a student USER, if the USER object is valid
Parameters:
Name Type Description
user object
callback function
Source:

addStudent(student, callback)

add a student
Parameters:
Name Type Description
student object
callback function
Source:

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:

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:

addToVirtualFileSystem(callback)

add item to the virtual file system
Parameters:
Name Type Description
callback function
Source:

addUser(user, callback)

add a user
Parameters:
Name Type Description
user object
callback function
Source:

changeAllVisibility(changeValue, callback)

Changes visibilty of all questions based on the changeValue
Parameters:
Name Type Description
changeValue boolean
callback funciton
Source:

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:

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:

chooseAllAttributeValidator(question) → {object}

choose all attribute validator
Parameters:
Name Type Description
question object
Source:
Returns:
Type
object

deleteQuestion(questionId, callback)

Deactivate the question with ID qid from the database.
Parameters:
Name Type Description
questionId string
callback function
Source:

error(text)

print an error message
Parameters:
Name Type Description
text string
Source:

existsSync(fileId, callback)

check if a directory exists
Parameters:
Name Type Description
fileId string
callback function
Source:

findInVirtualFileSystem(callback)

find in the virtual file system
Parameters:
Name Type Description
callback function
Source:

formatString() → {string}

formating a string based on an array of parts of the string
Source:
Returns:
Type
string

getAccuracyOverTime(query, callback)

get accuracy of user over time
Parameters:
Name Type Description
query object
callback function
Source:

getAccuracyPerTopicVsClass(query, callback)

get accuracy per question topic
Parameters:
Name Type Description
query object
callback function
Source:

getAccuracyPerTypeVsClass(query, callback)

get accuracy per question type
Parameters:
Name Type Description
query object
callback function
Source:

getAccuracyRankOverTime(query, callback)

get accuracy rank over time
Parameters:
Name Type Description
query object
callback function
Source:

getAccuracyVsClass(query, callback)

get questions answered vs class
Parameters:
Name Type Description
query object
callback function
Source:

getAdminById(adminId, callback)

get the admin object by Id if exists
Parameters:
Name Type Description
adminId string
callback function
Source:

getAdminById(adminId, callback)

get admin by id
Parameters:
Name Type Description
adminId string
callback function
Source:

getAdminsList(callback)

get admin list
Parameters:
Name Type Description
callback function
Source:

getAdminsList(callback)

Return an array of users in the database.
Parameters:
Name Type Description
callback function
Source:

getAllQuestionsByQuery(findQuery, sortQuery, callback)

get all questions list by Query
Parameters:
Name Type Description
findQuery object
sortQuery object
callback function
Source:

getAllQuestionsList(callback)

get all questions list
Parameters:
Name Type Description
callback function
Source:

getAllSettings(callback)

get all settings object from database
Parameters:
Name Type Description
callback function
Source:

getAllSettings(callback)

get all settings objects from the collection
Parameters:
Name Type Description
callback function
Source:

getAllSettings(callback)

get all settings object
Parameters:
Name Type Description
callback function
Source:

getAllSettings(callback)

get all settings objects from the collection
Parameters:
Name Type Description
callback function
Source:

getAnalytics(callback)

get analytics for a admins
Parameters:
Name Type Description
callback function
Source:

getAttemptRankOverTime(query, callback)

get attempt rank over time
Parameters:
Name Type Description
query object
callback function
Source:

getAverageRating(ratingsList)

get average rating
Parameters:
Name Type Description
ratingsList list
Source:

getChart(query, callback)

get the charts based on type
Parameters:
Name Type Description
query object
callback function
Source:

getClassAccuracy(query, callback)

get accuracy of the class
Parameters:
Name Type Description
query object
callback function
Source:

getClassAccuracyOverTime(query, callback)

get accuracy of the class over time
Parameters:
Name Type Description
query object
callback function
Source:

getClassAccuracyPerTopicVsClass(query, callback)

get class accuracy per question topic
Parameters:
Name Type Description
query object
callback function
Source:

getClassAccuracyPerTypeVsClass(query, callback)

get class accuracy per question type
Parameters:
Name Type Description
query object
callback function
Source:

getClassActive(callback)

check if the class is active
Parameters:
Name Type Description
callback funtion
Source:

getClassAnswered(query, callback)

get questions answered of the class
Parameters:
Name Type Description
query object
callback function
Source:

getClassAnsweredOverTime(query, callback)

get questions answered of the class over time
Parameters:
Name Type Description
query object
callback function
Source:

getClassOverall(query, callback)

get overall value of the class
Parameters:
Name Type Description
query object
callback function
Source:

getClassOverallOverTime(query, callback)

get overall average of the class over time
Parameters:
Name Type Description
query object
callback function
Source:

getClassPoints(query, callback)

get points of the class
Parameters:
Name Type Description
query object
callback function
Source:

getClassPointsOverTime(query, callback)

get points of the class over time
Parameters:
Name Type Description
query object
callback function
Source:

getClassPointsPerAttempt(query, callback)

get class points per attempt of the class
Parameters:
Name Type Description
query object
callback function
Source:

getClassPointsPerAttemptOverTime(query, callback)

get points per attempt average of the class over time
Parameters:
Name Type Description
query object
callback function
Source:

getClassPointsPerTopicVsClass(query, callback)

get class points per question topic
Parameters:
Name Type Description
query object
callback function
Source:

getClassPointsPerTypeVsClass(query, callback)

get class points per question type
Parameters:
Name Type Description
query object
callback function
Source:

getClassRating(query, callback)

get rating of the class
Parameters:
Name Type Description
query object
callback function
Source:

getClassRatingPerTopicVsClass(query, callback)

get class rating per topic vs class
Parameters:
Name Type Description
query object
callback function
Source:

getClassRatingPerTypeVsClass(query, callback)

get class rating per type vs class
Parameters:
Name Type Description
query object
callback function
Source:

getCorrectAttemptRankOverTime(query, callback)

get correct attempt rank over time
Parameters:
Name Type Description
query object
callback function
Source:

getCorrectAttemptsOverTime(query, callback)

get number correct attempts of user over time
Parameters:
Name Type Description
query object
callback function
Source:

getDate() → {string}

return the current date
Source:
Returns:
Type
string

getDateByFormat() → {string}

return the current date with format
Source:
Returns:
Type
string

getDateFormatedMinutesAgo(mins, format) → {string}

return the current date
Parameters:
Name Type Description
mins number
format string
Source:
Returns:
Type
string

getDateObject() → {date}

return the current date
Source:
Returns:
Type
date

getDiscussionboardDislikesEnabled(callback)

get discussionboard dislikes enabled
Parameters:
Name Type Description
callback funtion
Source:

getDiscussionboardVisibilityEnabled(callback)

get discussionboard visibility enabled
Parameters:
Name Type Description
callback funtion
Source:

getError(errorCode) → {object}

return an object of error code and message
Parameters:
Name Type Description
errorCode number
Source:
Returns:
Type
object

getFeedback(callback)

Get all the feedback stored in the collection
Parameters:
Name Type Description
callback function
Source:

getFullLeaderboard(callback)

Fetch a list of students to display in the leaderboard.
Parameters:
Name Type Description
callback function
Source:

getIdsListFromJSONList() → {array}

given a list of JSON objects that have Id as one of their feilds, return a list of Ids
Source:
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:

getLeaderboardLimit(callback)

get the limit of rows on the leaderboard
Parameters:
Name Type Description
callback funtion
Source:

getLeaderboardLimited(callback)

get the true of false if the leader board is set to a limit
Parameters:
Name Type Description
callback funtion
Source:

getNextQuestionNumber(callback)

get next question number
Parameters:
Name Type Description
callback function
Source:

getOverallOverTime(query, callback)

get points per attempts of user and class over time
Parameters:
Name Type Description
query object
callback function
Source:

getOverallRankOverTime(query, callback)

get overall rank over time
Parameters:
Name Type Description
query object
callback function
Source:

getOverallVsClass(query, callback)

get questions answered vs class
Parameters:
Name Type Description
query object
callback function
Source:

getPointsOverTime(query, callback)

get points of user over time
Parameters:
Name Type Description
query object
callback function
Source:

getPointsPerAttemptsOverTime(query, callback)

get points per attempts of user and class over time
Parameters:
Name Type Description
query object
callback function
Source:

getPointsPerAttemptVsClass(query, callback)

get questions answered vs class
Parameters:
Name Type Description
query object
callback function
Source:

getPointsPerTopicVsClass(query, callback)

get points per question topic
Parameters:
Name Type Description
query object
callback function
Source:

getPointsPerTypeVsClass(query, callback)

get points per question type
Parameters:
Name Type Description
query object
callback function
Source:

getPointsRankOverTime(query, callback)

get points rank over time
Parameters:
Name Type Description
query object
callback function
Source:

getPointsVsClass(query, callback)

get points vs class
Parameters:
Name Type Description
query object
callback function
Source:

getQuestionDefaultMaxPoints(callback)

get question default max points
Parameters:
Name Type Description
callback funtion
Source:

getQuestionDefaultMinPoints(callback)

get question default min points
Parameters:
Name Type Description
callback funtion
Source:

getQuestionDefaultTopic(callback)

get question default topic
Parameters:
Name Type Description
callback funtion
Source:

getQuestionsAnsweredVsClass(query, callback)

get questions answered vs class
Parameters:
Name Type Description
query object
callback function
Source:

getQuestionsList(findQuery, sortQuery, callback)

get the list of Active questions sorted
Parameters:
Name Type Description
findQuery object
sortQuery object
callback function
Source:

getQuestionsListByUser(request, callback)

Fetch the question list of userId
Parameters:
Name Type Description
request object
callback function
Source:

getQuestionsListforAdmin(findQuery, sortQuery, callback)

get the list of questions sorted
Parameters:
Name Type Description
findQuery object
sortQuery object
callback function
Source:

getQuestionTimeoutEnabled(callback)

get question timeout enabled
Parameters:
Name Type Description
callback funtion
Source:

getQuestionTimeoutPeriod(callback)

get question timeout period
Parameters:
Name Type Description
callback funtion
Source:

getRatingVsClass(query, callback)

get rating vs class
Parameters:
Name Type Description
query object
callback function
Source:

getStudentById(studentId, callback)

get the admin object by Id if exists
Parameters:
Name Type Description
studentId string
callback function
Source:

getStudentById(studentId, callback)

get student by id
Parameters:
Name Type Description
studentId string
callback function
Source:

getStudentEditEmailEnabled(callback)

check if the student can edit their email
Parameters:
Name Type Description
callback funtion
Source:

getStudentEditNameEnabled(callback)

check if the student can edit their first and last name
Parameters:
Name Type Description
callback funtion
Source:

getStudentEditPasswordEnabled(callback)

check if the student can edit their password
Parameters:
Name Type Description
callback funtion
Source:

getStudentsList(callback)

get student list
Parameters:
Name Type Description
callback function
Source:

getStudentsList(callback)

get students list
Parameters:
Name Type Description
callback function
Source:

getStudentsListSorted(lim, callback)

Return an array of users in the database, sorted by rank.
Parameters:
Name Type Description
lim int
callback function
Source:

getStudentsListSorted(lim, callback)

get students list sorted
Parameters:
Name Type Description
lim int
callback function
Source:

getStudentsListWithStatus(status, callback)

get students list with status
Parameters:
Name Type Description
status string
callback function
Source:

getStudentsListWithStatus(active, callback)

get students list with status
Parameters:
Name Type Description
active boolean
callback function
Source:

getTime() → {string}

return the time in "<0> days, <0> hours, <0> minutes, <0> seconds" format
Source:
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:

getUserById(userId, callback)

get user by id
Parameters:
Name Type Description
userId string
callback function
Source:

getUserById(userId, callback)

get user by id
Parameters:
Name Type Description
userId string
callback function
Source:

getUserById(userId, callback)

Fetch the user object with ID iserId in the users database.
Parameters:
Name Type Description
userId string
callback function
Source:

getUserByUsername(adminId, callback)

get the user object by username if exists
Parameters:
Name Type Description
adminId string
callback function
Source:

getUserObject(findQuery, callback)

get user by search query
Parameters:
Name Type Description
findQuery object
callback function
Source:

getUsersList(callback)

get users list
Parameters:
Name Type Description
callback function
Source:

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:

getUsersList(callback)

get users list
Parameters:
Name Type Description
callback function
Source:

getUUID() → {string}

get a unique Id
Source:
Returns:
Type
string

getVariableType(variable)

get variable type
Parameters:
Name Type Description
variable *
Source:

init()

initiate the logging with file
Source:

initialize()

Initialize allSettings object
Source:

initialize(callback)

Open a connection to the database
Parameters:
Name Type Description
callback function
Source:

initialize(callback)

start the analytics daily process
Parameters:
Name Type Description
callback function
Source:

isEmptyObject() → {boolean}

check if json obejct is empty
Source:
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:
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:

log(text)

print a normal message
Parameters:
Name Type Description
text string
Source:

lookupQuestion(findQuery, callback)

Extract a question object from the database using its ID
Parameters:
Name Type Description
findQuery object
callback function
Source:

lookupQuestionById(questionId, callback)

lookup question in database
Parameters:
Name Type Description
questionId string
callback function
Source:

lookupQuestionById(questionId, callback)

Extract a question object from the database using its ID.
Parameters:
Name Type Description
questionId string
callback function
Source:

matchingAttributeValidator(question) → {object}

matching attribute validator
Parameters:
Name Type Description
question object
Source:
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:

multipleChoiceAttributeValidator(question) → {object}

multiple choice attribute validator
Parameters:
Name Type Description
question object
Source:
Returns:
Type
object

orderingAttributeValidator(question) → {object}

ordering attribute validator
Parameters:
Name Type Description
question object
Source:
Returns:
Type
object

prepareQuestionData(question, callback)

Prepare question data on first pass to DB
Parameters:
Name Type Description
question object
callback function
Source:

qTypeFailMsg(message) → {object}

Send back specific error message by question type
Parameters:
Name Type Description
message string
Source:
Returns:
Type
object

questionCreationValidation(info) → {object}

Validate all question fields on first entry to db
Parameters:
Name Type Description
info object
Source:
Returns:
Type
object

questionUpdateParser(question)

Preparing data on update/edit of a question
Parameters:
Name Type Description
question object
Source:

randomizeList() → {array}

shuffle the given list and return the result as a new list
Source:
Returns:
Type
array

regexAttributeValidator(question) → {object}

regex attribute validator
Parameters:
Name Type Description
question object
Source:
Returns:
Type
object

removeAllQuestions(callback)

cleanup the users collection
Parameters:
Name Type Description
callback function
Source:

removeAllUsers(callback)

cleanup the users collection
Parameters:
Name Type Description
callback function
Source:

removeAnalytics(callback)

remove all previous analytics
Parameters:
Name Type Description
callback function
Source:

removeAnalytics(callback)

clean all previous analytics data
Parameters:
Name Type Description
callback function
Source:

removeVirtualFileSystem(callback)

clean up the virtual file system
Parameters:
Name Type Description
callback function
Source:

removeVirtualFileSystem(callback)

clean up the virtual file system
Parameters:
Name Type Description
callback function
Source:

resetAllSettings(callback)

reset the global settings to their default values
Parameters:
Name Type Description
callback function
Source:

resetAllSettings(callback)

reset all settings to default
Parameters:
Name Type Description
callback function
Source:

resetAllSettings(callback)

reset all settings to default
Parameters:
Name Type Description
callback function
Source:

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:

rmrf(parentPath, directoryName, callback)

BE CAREFUL: perform rm -rf on a directory
Parameters:
Name Type Description
parentPath string
directoryName string
callback function
Source:

setClassActive(isActive, callback)

set class activation status
Parameters:
Name Type Description
isActive boolean
callback funtion
Source:

setDiscussionboardDislikesEnabled(isActive, callback)

set discussionboard dislikes enabled
Parameters:
Name Type Description
isActive boolean
callback funtion
Source:

setDiscussionboardVisibilityEnabled(isActive, callback)

set discussionboard visibility enabled
Parameters:
Name Type Description
isActive boolean
callback funtion
Source:

setLeaderboardLimit(limit, callback)

set leaderboard limit
Parameters:
Name Type Description
limit number
callback funtion
Source:

setLeaderboardLimited(limit, callback)

set leaderboard limit
Parameters:
Name Type Description
limit number
callback funtion
Source:

setQuestionDefaultMinPoints(points, callback)

get question default min points
Parameters:
Name Type Description
points number
callback funtion
Source:

setQuestionDefaultMinPoints(points, callback)

get question default max points
Parameters:
Name Type Description
points number
callback funtion
Source:

setQuestionDefaultTopic(topic, callback)

set question default topic
Parameters:
Name Type Description
topic string
callback funtion
Source:

setQuestionTimeoutEnabled(isActive, callback)

set question timeout enabled
Parameters:
Name Type Description
isActive boolean
callback funtion
Source:

setQuestionTimeoutPeriod(timeout, callback)

set question timeout period
Parameters:
Name Type Description
timeout number
callback funtion
Source:

setStudentEditEmailEnabled(isActive, callback)

set student edit email enabled
Parameters:
Name Type Description
isActive boolean
callback funtion
Source:

setStudentEditNameEnabled(isActive, callback)

set student edit name enabled
Parameters:
Name Type Description
isActive boolean
callback funtion
Source:

setStudentEditPasswordEnabled(isActive, callback)

set student edit password enabled
Parameters:
Name Type Description
isActive boolean
callback funtion
Source:

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:

sortLeaderBoard(list, criteria)

sort leaderboard based on criteria
Parameters:
Name Type Description
list list
criteria string
Source:

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:

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:

submitRating(questionId, userId, rating, callback)

adding rating to question collection
Parameters:
Name Type Description
questionId string
userId string
rating number
callback function
Source:

submitRating(userId, questionId, rating, callback)

adding rating to question collection
Parameters:
Name Type Description
userId string
questionId string
rating int
callback function
Source:

sumListOfNumbers(list)

return a number as the sum of all numbers in a list
Parameters:
Name Type Description
list list
Source:

trueAndFalseAttributeValidator(question) → {object}

true and false attribute validator
Parameters:
Name Type Description
question object
Source:
Returns:
Type
object

updateAdminById(userId, info, callback)

update admin by id
Parameters:
Name Type Description
userId string
info object
callback function
Source:

updateAdminById(userId, info, callback)

update admin by id
Parameters:
Name Type Description
userId string
info object
callback function
Source:

updateProfile(userId, request, callback)

update user's profile based on the given infomation
Parameters:
Name Type Description
userId string
request object
callback function
Source:

updateQuestionById(questionId, request, callback)

update a question record based on its id
Parameters:
Name Type Description
questionId string
request object
callback function
Source:

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:

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:

updateQuestionByQuery(query, update, callback)

update users collection directly by a query
Parameters:
Name Type Description
query object
update object
callback function
Source:

updateSettings(updateObject, callback)

update multiple settings based on the passed params
Parameters:
Name Type Description
updateObject object
callback function
Source:

updateSettings(updateQuery, callback)

update settings object
Parameters:
Name Type Description
updateQuery object
callback function
Source:

updateSettings(findQuery, updateQuery, callback)

update settings object
Parameters:
Name Type Description
findQuery object
updateQuery object
callback function
Source:

updateStudentById(userId, info, callback)

update student by id
Parameters:
Name Type Description
userId string
info object
callback function
Source:

updateStudentById(userId, info, callback)

update student by id
Parameters:
Name Type Description
userId string
info object
callback function
Source:

updateUserById(userId, info, callback)

update user by id
Parameters:
Name Type Description
userId string
info object
callback function
Source:

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:

updateUserById(userId, info, callback)

update user by id
Parameters:
Name Type Description
userId string
info object
callback function
Source:

updateUserByQuery(query, update, callback)

update users collection directly by a query
Parameters:
Name Type Description
query object
update object
callback function
Source:

updateUserPassword(query, update, password, callback)

update user password
Parameters:
Name Type Description
query object
update object
password string
callback function
Source:

updateUserPassword(query, update, password, callback)

update user password
Parameters:
Name Type Description
query object
update object
password string
callback function
Source:

updateUserSubmissionTime(userId, question, callback)

Updates the Users Submission time for a Question
Parameters:
Name Type Description
userId string
question object
callback function
Source:

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:
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:
Returns:
Type
boolean

validateAttributeFields(question, type) → {object}

Validate all fields that will be modified
Parameters:
Name Type Description
question object
type string
Source:
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:
Returns:
Type
boolean

validateDefaultQuestionValues(questionData) → {object}

validate default question values
Parameters:
Name Type Description
questionData number
Source:
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:

validateQuestionAttributesByType(question, type) → {object}

validate question attributes by type
Parameters:
Name Type Description
question object
type string
Source:
Returns:
Type
object

verifyAnswer(question, answer)

verify answer based on type
Parameters:
Name Type Description
question object
answer *
Source:

verifyChooseAllQuestionAnswer(question, answer)

verify choose all question answer
Parameters:
Name Type Description
question object
answer *
Source:

verifyMatchingQuestionAnswer(question, answer)

verify matching question answer
Parameters:
Name Type Description
question object
answer *
Source:

verifyOrderingQuestionAnswer(question, answer)

Check if answer submitted is correct for Ordering question Type
Parameters:
Name Type Description
question object
answer *
Source:

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:

voteReply(replyId, vote, userId, callback)

vote on a reply
Parameters:
Name Type Description
replyId string
vote number
userId string
callback function
Source:

writeFile(fileObj, callback)

write data to a fils
Parameters:
Name Type Description
fileObj object
callback function
Source: