PEDR_PEDCompletionEngine_TDTM
PE Discipline Requirement trigger handler/TDTM for completion engine
Custom Permission | REDU - Admin, REDU - Faculty, REDU - Student |
Event | BeforeInsert, BeforeUpdate, AfterInsert, AfterUpdate, AfterDelete, AfterUndelete |
Object |
PE Discipline Requirement |
Related RIO Education Settings | Course PE Discipline Requirement RT Id |
Description
Whenever a new Course PE Discipline Requirement with a related Course Connection and a checked 'Revalidate Completion' field is inserted, or whenever an existing Course PE Discipline Requirement's Course Connection, 'Revalidate Completion' or 'Credits Earned' fields are updated, this class checks whether the Course Connection's 'Release Grades' field is checked.
If it is, the PE Discipline Requirement will be updated based on the Course Connection. If the Course Connection's Enrollment Status is Completed and its Grade Result is either Pass, RPL, Credit Transfer or Waiver, then the Complete field is checked.
If the PE Discipline Requirement is Primary, then the Credits Earned field is taken from the equivalent field on Course Connection. Otherwise, it is set to 0. If the Course Connection's Release Grades field was not checked, then the PE Discipline Requirement's Complete field is not checked and the Credits Earned is not set.
If the PEDR Credits Method custom setting is set to Sequence, then this class will also check if there are multiple PE Discipline Requirements for the same Course against the same PE Discipline. In order to stop Credits Earned from a Course being added multiple times, it will use a combination of the Sequence field and the current tally of credits to find the best PE Discipline Requirement to take the credits from. All other PE Discipline Requirements will have their Credits Earned fields set to 0.
Additionally, for insert, update, delete and undelete on both Course and Group record types, this class will recalculate whether the parent PE Discipline Requirement (if the triggering record type is Course) or PE Discipline (if the triggering record type is Group) has had its requirements met or failed as a result of the change and update the parent accordingly.
If the parent is a PE Discipline Requirement, it will roll up a sum of the children's Credits Earned to the parent's Credits Earned field and if this sum is greater than or equal to its Credits Required field, and if all child records with a Requirement of Mandatory have been completed, then it will set the Complete field to true. If these requirements are not met, Complete will be false.
If the parent is a PE Discipline, it will calculate the credits earned and if it is greater than or equal to the Credits field, then the Status field will be set to Completed and the Completion Date will be set to the current date. Otherwise, the Status is set to Current and the Completion Date is cleared.