Safe Haskell | None |
---|---|
Language | Haskell2010 |
WeekDaze.Data.Course
Description
AUTHOR
- Dr. Alistair Ward
DESCRIPTION
- Describes the attributes of a course; https://en.wikipedia.org/wiki/Course_(education).
Synopsis
- data Course synchronisationId level timeslotId
- maximumClassSizeTag :: String
- minimumConsecutiveLessonsTag :: String
- requiredFacilitiesTag :: String
- requiredLessonsPerWeekTag :: String
- defaultMinimumConsecutiveLessons :: NTimeslots
- countStudentPlaces :: Course synchronisationId level timeslotId -> Profile campus -> NStudents
- calculateIdealConsecutiveLessons :: Fractional f => Course synchronisationId level timeslotId -> f
- mkCourse :: (Show level, Show synchronisationId, Show timeslotId) => Subject level -> NTimeslots -> FacilityNames -> TimeslotRequest timeslotId -> NTimeslots -> Maybe NStudents -> Maybe synchronisationId -> Course synchronisationId level timeslotId
- isSuitable :: Eq level => NStudents -> Subject level -> Course synchronisationId level timeslotId -> Bool
- specifiesTimes :: Course synchronisationId level timeslotId -> Bool
- isASpecifiedTime :: Ord timeslotId => Time timeslotId -> Course synchronisationId level timeslotId -> Bool
- isASpecifiedDay :: Day -> Course synchronisationId level timeslotId -> Bool
- isFluid :: Course synchronisationId level timeslotId -> Bool
- isRigid :: Course synchronisationId level timeslotId -> Bool
- hasRigidlySpecifiedDays :: Course synchronisationId level timeslotId -> Bool
- requiresConsecutiveLessons :: Course synchronisationId level timeslotId -> Bool
- requestsSeparatedTimelotsWithinAnyDay :: (Enum timeslotId, Ord timeslotId) => Course synchronisationId level timeslotId -> Bool
- isSynchronised :: Course synchronisationId level timeslotId -> Bool
Types
Data-types
data Course synchronisationId level timeslotId Source #
The attributes of a course.
Instances
(Eq level, Eq timeslotId, Eq synchronisationId) => Eq (Course synchronisationId level timeslotId) Source # | |
(Ord level, Ord timeslotId, Ord synchronisationId) => Ord (Course synchronisationId level timeslotId) Source # | |
Defined in WeekDaze.Data.Course Methods compare :: Course synchronisationId level timeslotId -> Course synchronisationId level timeslotId -> Ordering # (<) :: Course synchronisationId level timeslotId -> Course synchronisationId level timeslotId -> Bool # (<=) :: Course synchronisationId level timeslotId -> Course synchronisationId level timeslotId -> Bool # (>) :: Course synchronisationId level timeslotId -> Course synchronisationId level timeslotId -> Bool # (>=) :: Course synchronisationId level timeslotId -> Course synchronisationId level timeslotId -> Bool # max :: Course synchronisationId level timeslotId -> Course synchronisationId level timeslotId -> Course synchronisationId level timeslotId # min :: Course synchronisationId level timeslotId -> Course synchronisationId level timeslotId -> Course synchronisationId level timeslotId # | |
(Show synchronisationId, Show level, Show timeslotId) => Show (Course synchronisationId level timeslotId) Source # | |
(NFData level, NFData synchronisationId, NFData timeslotId) => NFData (Course synchronisationId level timeslotId) Source # | |
Defined in WeekDaze.Data.Course | |
(XmlPickler level, XmlPickler synchronisationId, XmlPickler timeslotId, Ord timeslotId, Show level, Show synchronisationId, Show timeslotId) => XmlPickler (Course synchronisationId level timeslotId) Source # | |
Defined in WeekDaze.Data.Course | |
(Show level, Show synchronisationId, Show timeslotId) => SelfValidator (Course synchronisationId level timeslotId) Source # | |
Constants
maximumClassSizeTag :: String Source #
Used to qualify Output, SQL & XML.
minimumConsecutiveLessonsTag :: String Source #
Used to qualify Output, SQL & XML.
requiredFacilitiesTag :: String Source #
Used to qualify Output & XML.
requiredLessonsPerWeekTag :: String Source #
Used to qualify Output, SQL & XML.
defaultMinimumConsecutiveLessons :: NTimeslots Source #
The default value for getMinimumConsecutiveLessons
.
Functions
countStudentPlaces :: Course synchronisationId level timeslotId -> Profile campus -> NStudents Source #
Get the number of student-places, when accounting for the capacity-limits imposed by both the course & the location; but not for any students already booked.
calculateIdealConsecutiveLessons :: Fractional f => Course synchronisationId level timeslotId -> f Source #
- The required lessons per week would typically be an integral multiple of the minimum consecutive lessons, but otherwise some sessions must be longer to absorb the fractional remainder.
- Ideally the required number of lessons would be divided equally amongst the maximum possible number of sessions, to make the session-durations as equal as possible.
- This function returns that ideal mean fractional duration, of the integral session-durations. Eg:
requiredLessonsPerWeek minimumConsecutiveLessons isolated sessions ideal mean session-duration ====================== ========================= ================= =========================== 7 2 3 7/3 == 2.33 7 3 2 7/2 == 3.5 7 4 1 7 11 3 3 11/3 == 3.67
- CAVEAT: when the ideal is non-integral, it can never be achieved in practice; deviations from this ideal of less than half a time-slot, are therefore insignificant.
Constructor
Arguments
:: (Show level, Show synchronisationId, Show timeslotId) | |
=> Subject level | The topic & level at which it is to be taught. |
-> NTimeslots | The required number of time-slots per week. |
-> FacilityNames | The set of things required for the course. |
-> TimeslotRequest timeslotId | The ideal time-slot or specified times, at which to book lessons in this course. |
-> NTimeslots | The minimum number of consecutive time-slots required for any booking in this subject. |
-> Maybe NStudents | The maximum class-size. |
-> Maybe synchronisationId | The optional identifier of a set of courses, whose lessons must be synchronised. |
-> Course synchronisationId level timeslotId |
Smart constructor.
Predicates
isSuitable :: Eq level => NStudents -> Subject level -> Course synchronisationId level timeslotId -> Bool Source #
True
if the course is in the required subject & its teacher can cater for the required number of students.
specifiesTimes :: Course synchronisationId level timeslotId -> Bool Source #
True if times have been specified.
isASpecifiedTime :: Ord timeslotId => Time timeslotId -> Course synchronisationId level timeslotId -> Bool Source #
True if the course requests booking of a lesson at the specified time.
isASpecifiedDay :: Day -> Course synchronisationId level timeslotId -> Bool Source #
True if the one of the specified times for the course, falls on the specified day.
isFluid :: Course synchronisationId level timeslotId -> Bool Source #
True if zero lessons of the course are to be booked at specified times.
isRigid :: Course synchronisationId level timeslotId -> Bool Source #
True if all lessons of the course are required to be booked at specified times.
hasRigidlySpecifiedDays :: Course synchronisationId level timeslotId -> Bool Source #
- True if the days on which lessons must be booked, is known.
- CAVEAT: this result doesn't account for the case where multiple times have been specified for one day, but can't be booked as one span of minimumConsecutiveLessons because of the extent of the gaps between.
requiresConsecutiveLessons :: Course synchronisationId level timeslotId -> Bool Source #
True if all bookings require more than one consecutive identical lesson.
requestsSeparatedTimelotsWithinAnyDay :: (Enum timeslotId, Ord timeslotId) => Course synchronisationId level timeslotId -> Bool Source #
True if the course specifies times which can't be satisfied without splitting the session in at least one day.
isSynchronised :: Course synchronisationId level timeslotId -> Bool Source #
- True if the course references a synchronisationId.
- CAVEAT: doesn't account for the possibility that this is the only course to reference this specified synchronisationId.