Extends
- api/base~BaseSlugCollection
Methods
# 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 slugID and interestIDs.
A (possibly empty) array of strings indicating integrity issues.
# define(description, name, shortName, slug, num, creditHrs, interests, syllabus, corequisites, prerequisites, retired)
Defines a new Course.
Parameters:
Name | Type | Description |
---|---|---|
description |
Object | Object with keys name, shortName, slug, num, description, creditHrs, interests, syllabus, and prerequisites. |
name |
is the official course name. |
|
shortName |
is an optional abbreviation. Defaults to name. |
|
slug |
must not be previously defined. |
|
num |
the course number. |
|
creditHrs |
is optional and defaults to 3. If supplied, must be a num between 1 and 15. |
|
interests |
is a (possibly empty) array of defined interest slugs or interestIDs. |
|
syllabus |
is optional. If supplied, should be a URL. |
|
corequisites |
is optional. If supplied, must be an array of Course slugs or courseIDs. |
|
prerequisites |
is optional. If supplied, must be an array of previously defined Course slugs or courseIDs. |
|
retired |
is optional, defaults to false. |
If the definition includes a defined slug or undefined interest or invalid creditHrs.
The newly created docID.
Example
Courses.define({ name: 'Introduction to the theory and practice of scripting',
shortName: 'Intro to Scripting',
slug: 'ics_215',
num: 'ICS 215',
description: 'Introduction to scripting languages for the integration of applications.',
creditHrs: 4,
interests: ['perl', 'javascript', 'ruby'],
syllabus: 'http://courses.ics.hawaii.edu/syllabuses/ICS215.html',
prerequisites: ['ics_211'] });
# dumpOne(docID) → {Object}
Returns an object representing the Course docID in a format acceptable to define().
Parameters:
Name | Type | Description |
---|---|---|
docID |
The docID of a Course. |
An object representing the definition of docID.
# findNames(instanceIDs) → {Array}
Returns a list of Course names corresponding to the passed list of Course docIDs.
Parameters:
Name | Type | Description |
---|---|---|
instanceIDs |
A list of Course docIDs. |
If any of the instanceIDs cannot be found.
# hasInterest(course, interest) → {boolean}
Returns true if Course has the specified interest.
Parameters:
Name | Type | Description |
---|---|---|
course |
The user (docID or slug) |
|
interest |
The Interest (docID or slug). |
If course is not a course or interest is not a Interest.
True if the course has the associated Interest.
# removeIt(instance)
Remove the Course.
Parameters:
Name | Type | Description |
---|---|---|
instance |
The docID or slug of the entity to be removed. |
If docID is not a Course, or if this course has any associated course instances.
# update(instance, name, shortName, num, description, creditHrs, interests, syllabus, prerequisites, retired)
Update a Course.
Parameters:
Name | Type | Description |
---|---|---|
instance |
The docID (or slug) associated with this course. |
|
name |
optional |
|
shortName |
optional |
|
num |
optional |
|
description |
optional |
|
creditHrs |
optional |
|
interests |
An array of interestIDs or slugs (optional) |
|
syllabus |
optional |
|
prerequisites |
An array of course slugs. (optional) |
|
retired |
optional boolean. |