Class

FavoriteCourseCollection

FavoriteCourseCollection()

Constructor

# new FavoriteCourseCollection()

Creates the FavoriteCourse collection

View Source api/favorite/FavoriteCourseCollection.ts, line 12

Methods

# assertValidRoleForMethod(userId)

Implementation of assertValidRoleForMethod. Asserts that userId is logged in as an Admin, Advisor or Student. This is used in the define, update, and removeIt Meteor methods associated with each class.

Parameters:
Name Type Description
userId

The userId of the logged in user. Can be null or undefined

View Source api/favorite/FavoriteCourseCollection.ts, line 105

If there is no logged in user, or the user is not an Admin or Advisor.

Meteor.Error

# checkIntegrity() → {Array}

Returns an array of strings, each one representing an integrity problem with this collection. Returns an empty array if no problems were found. Checks semesterID, courseID, and studentID.

View Source api/favorite/FavoriteCourseCollection.ts, line 156

A (possibly empty) array of strings indicating integrity issues.

Array

# define(course, student, retired) → {void|*|boolean|Object}

Defines a new FavoriteCourse.

Parameters:
Name Type Description
course

the course slug.

student

the student's username.

retired

the retired status.

View Source api/favorite/FavoriteCourseCollection.ts, line 29

void | * | boolean | Object

# dumpOne(docID) → {Object}

Returns an object representing the FavoriteCourse docID in a format acceptable to define().

Parameters:
Name Type Description
docID

The docID of a FavoriteCourse.

View Source api/favorite/FavoriteCourseCollection.ts, line 174

An object representing the definition of docID.

Object

# getCourseDoc(instanceID) → {Object}

Returns the Course associated with the FavoriteCourse with the given instanceID.

Parameters:
Name Type Description
instanceID

The id of the CourseInstance.

View Source api/favorite/FavoriteCourseCollection.ts, line 114

If instanceID is not a valid ID.

Meteor.Error

The associated Course.

Object

# getCourseSlug(instanceID) → {string}

Returns the Course slug for the favorite's corresponding Course.

Parameters:
Name Type Description
instanceID

The FavoriteCourse ID.

View Source api/favorite/FavoriteCourseCollection.ts, line 124

The course slug.

string

# getStudentDoc(instanceID) → {Object}

Returns the Student profile associated with the FavoriteCourse with the given instanceID.

Parameters:
Name Type Description
instanceID

The ID of the FavoriteCourse.

View Source api/favorite/FavoriteCourseCollection.ts, line 135

If instanceID is not a valid ID.

Meteor.Error

The associated Student profile.

Object

# getStudentUsername(instanceID) → {*}

Returns the username associated with the studentID.

Parameters:
Name Type Description
instanceID

the FavoriteCourse id.

View Source api/favorite/FavoriteCourseCollection.ts, line 145

*

# publish()

Publish CourseFavorites. If logged in as ADMIN get all, otherwise only get the CourseFavorites for the studentID. Also publishes the CourseFavorites scoreboard.

View Source api/favorite/FavoriteCourseCollection.ts, line 72

# removeIt(docID)

Remove the FavoriteCourse.

Parameters:
Name Type Description
docID

The docID of the FavoriteCourse.

View Source api/favorite/FavoriteCourseCollection.ts, line 55

# removeUser(user)

Removes all the FavoriteCourses for the user.

Parameters:
Name Type Description
user

the username.

View Source api/favorite/FavoriteCourseCollection.ts, line 64

# update(docID, retired)

Updates the retired status.

Parameters:
Name Type Description
docID

the ID of the FavoriteCourse.

retired

the new retired value.

View Source api/favorite/FavoriteCourseCollection.ts, line 43