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, repeatable, retired)
Defines a new Course.
Parameters:
Name | Type | Description |
---|---|---|
description |
Object | Object with keys name, shortName, slug, num, description, creditHrs, interests, syllabus. |
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. |
|
repeatable |
is optional, defaults to false. |
|
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',
});
# 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.
# findCourseNumberByName(name) → {string}
Returns the course number of the course name
Parameters:
Name | Type | Description |
---|---|---|
name |
string |
# findDoc(name) → {Object}
Courses have names, but they also have a method 'getName' that returns the ${num}: ${shortName}
. This method
will return the doc that has that getName.
Parameters:
Name | Type | Description |
---|---|---|
name |
String | Object | Either the docID, or an object selector, or the 'name' field value. |
If the document cannot be found.
The document associated with name.
# 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.
# findRelatedCareerGoals(docIdOrSlug) → {Array.<CareerGoals>}
Returns a list of CareerGoals that have common interests.
Parameters:
Name | Type | Description |
---|---|---|
docIdOrSlug |
string | a course ID or slug. |
CareerGoals that share the interests.
# findRelatedInternships(docIdOrSlug) → {Array.<Internship>}
Returns a list of Internships that have common interests.
Parameters:
Name | Type | Description |
---|---|---|
docIdOrSlug |
string | a course ID or slug. |
Internships that share the interests.
# findRelatedOpportunities(docIdOrSlug) → {Array.<Opportunity>}
Returns a list of the Opportunities that have common interests.
Parameters:
Name | Type | Description |
---|---|---|
docIdOrSlug |
string | a course ID or slug. |
Opportunities that share the interests.
# getName(docIdOrSlug) → {string}
Returns the name of the ID or slug.
Parameters:
Name | Type | Description |
---|---|---|
docIdOrSlug |
string | an ID or slug. |
Course number and short name.
# 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, repeatable, 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 |
|
repeatable |
optional boolean. |
|
retired |
optional boolean. |