Schedules a learning module by tying a calendar event to a particular programme, course and module on a website, optionally for one cohort. One module can have many scheduled events, for example the same workshop run several times or run separately for each cohort, so there is one row per occurrence. The module is identified by the three codes rather than by a foreign key, and the timing lives entirely on the linked CalEvent, which is why the helpers here take the current date as an argument.
Group: Database Entities
Implements: Serializable
Properties
| Property | Returns | Description |
|---|---|---|
| calEvent | CalEvent | The calendar event that carries the start and end times of this occurrence. All the timing helpers on this class read from it. |
| cohort | Organisation | The cohort this occurrence is run for, when the module is scheduled separately per cohort. |
| courseCode | String | Code of the course containing the scheduled module, which is the name of its directory in the website content. Never null. |
| id | long | Database identifier for this scheduled event. |
| moduleCode | String | Code of the scheduled module. A module is a directory in the website content and this is the name of that directory, so it must be unique across the whole learning organisation and must not change once the module is published. Never null. |
| programCode | String | Code of the programme containing the scheduled module, which is the name of its directory in the website content. Never null. |
| website | Website | The website the scheduled module belongs to. The programme, course and module codes are resolved within this website. Never null. |
Methods
getId() · setId(long id) · getWebsite() · setWebsite(Website website) · getProgramCode() · setProgramCode(String programCode) · getCourseCode() · setCourseCode(String courseCode) · getModuleCode() · setModuleCode(String moduleCode) · getCalEvent() · setCalEvent(CalEvent calEvent) · getCohort() · setCohort(Organisation cohort) · isStarted(Date now) · isFinished(Date now) · isInProgress(Date now) · isAboutToStart(Date now, int mins) · numSubmitted()
getId()
Returns: long
Database identifier for this scheduled event.
setId(long id)
Returns: void
Sets the database identifier. Normally only assigned by the persistence layer.
| Parameter | Description |
|---|---|
id | the primary key to assign |
getWebsite()
Returns: Website
The website the scheduled module belongs to. The programme, course and module codes are resolved within this website. Never null.
setWebsite(Website website)
Returns: void
Sets the website the scheduled module belongs to. Required.
| Parameter | Description |
|---|---|
website | the website the schedule belongs to |
getProgramCode()
Returns: String
Code of the programme containing the scheduled module, which is the name of its directory in the website content. Never null.
setProgramCode(String programCode)
Returns: void
Sets the code of the programme containing the module. Required.
| Parameter | Description |
|---|---|
programCode | the programme code |
getCourseCode()
Returns: String
Code of the course containing the scheduled module, which is the name of its directory in the website content. Never null.
setCourseCode(String courseCode)
Returns: void
Sets the code of the course containing the module. Required.
| Parameter | Description |
|---|---|
courseCode | the course code |
getModuleCode()
Returns: String
Code of the scheduled module. A module is a directory in the website content and this is the name of that directory, so it must be unique across the whole learning organisation and must not change once the module is published. Never null.
setModuleCode(String moduleCode)
Returns: void
Sets the code of the scheduled module. Required, and it must match the module's directory name.
| Parameter | Description |
|---|---|
moduleCode | the module code |
getCalEvent()
Returns: CalEvent
The calendar event that carries the start and end times of this occurrence. All the timing helpers on this class read from it.
setCalEvent(CalEvent calEvent)
Returns: void
Sets the calendar event holding the timing of this occurrence.
| Parameter | Description |
|---|---|
calEvent | the calendar event to link |
getCohort()
Returns: Organisation
The cohort this occurrence is run for, when the module is scheduled separately per cohort.
setCohort(Organisation cohort)
Returns: void
Sets the cohort this occurrence is run for.
| Parameter | Description |
|---|---|
cohort | the cohort organisation, or null if it applies to everyone |
isStarted(Date now)
Returns: boolean
Whether the occurrence has started, that is its calendar event's start date is in the past. An event with no start date is never treated as started.
| Parameter | Description |
|---|---|
now | the time to compare the start date against |
isFinished(Date now)
Returns: boolean
Whether the occurrence has finished, that is its calendar event's end date is in the past. An event with no end date is never treated as finished, so it runs indefinitely.
| Parameter | Description |
|---|---|
now | the time to compare the end date against |
isInProgress(Date now)
Returns: boolean
Whether the occurrence has started and has not yet finished. An event with a start date but no end date counts as in progress once it has started.
| Parameter | Description |
|---|---|
now | the time to test against |
isAboutToStart(Date now, int mins)
Returns: boolean
Whether the occurrence starts within the next given number of minutes and has not started yet. Useful for sending reminders.
| Parameter | Description |
|---|---|
now | the time to measure the window from |
mins | how many minutes ahead to look |
numSubmitted()
Returns: long
Counts the module statuses submitted against this scheduled occurrence, using the current session. This runs a query, so avoid calling it in a loop.