A Bundle is a collection of courses that are bundled together and priced as a single entity. Bundles can be free or paid. Bundle pricing overrides any individual course pricing.
Tables
| bundles |
| id |
| title |
| description |
| user_id |
| display_in_catalog |
| display_in_catalog_start_date |
| display_in_catalog_end_date |
| free |
| price |
| archived_at |
| deleted_at |
| auto_enroll |
| created_at |
| updated_at |
| bundle_items |
| id |
| bundle_id |
| bundleable_id |
| bundleable_type |
| start_immediatly (Boolean) |
| start_after_item_id (Integer) |
| start_at (Datetime) |
| created_at |
| updated_at |
Modify enrollments table and add following columns
| enrollments |
| bundle_id |
| is_available |
Main UI Components
Implementation approach
1) Steps to perform when a user enrolls to a Bundle
First create an enrollment record for the bundle itself. Note that enrollment of type='Bundle' will never show up in “What i am workin on” section.
Create records in the enrollments table for all the items(products) that are part of the bundle. For each enrollment record that will be created do following
2) Steps to perform when a user's enrollment reaches completion
3) Run a scheduled job (every few minutes) that queries for all the enrollments where bundle_id != NULL.
—Edit (May 16, 2014)—
Below is the current behavior:
Use case 1
1) Instructor creates a Bundle (Bundle 1) with following items
Course 1 - Starts Immediately Course 2 - Starts After 'Course 1'
2) Instructor creates another bundle (Bundle 2) with following items
Course 2 - Starts Immediately Course 3 - Starts After 'Course 2'
3) Learner enrolls to 'Bundle 1'. After enrollment he would see
a) 'Course 1' in 'What am i working' section b) 'Course 2' in available Soon section with a message that it will start after 'Course 1' and that 'Course 2' belongs to 'Bundle 1'
4) Now the Learner enrolls to 'Bundle 2'. After enrollment he would see
a) 'Course 1' continues to appear in 'What am i working' section' b) 'Course 2' in available Soon section with a message that it will start after 'Course 1' and that 'Course 2' belongs to 'Bundle 1' (No change here) c) 'Course 3' in available soon section with message that it will start after 'Course 2' and that 'Course 3' belongs to 'Bundle 2'.
Because of the way the bundle enrollment currently works, the Learner will not able to start the 'Course 2' immediately (which is the rule specified in Bundle 2). Basically if the user is already enrolled to a course as part of bundle then then enrolls to another bundle which has the same course, then the rules of the 1st bundle enrollment applies.
Below is how the new behavior is expected to work.
Use case 1
1) Instructor creates a Bundle (Bundle 1) with following items
Course 1 - Starts Immediately Course 2 - Starts After 'Course 1'
2) Instructor creates another bundle (Bundle 2) with following items
Course 2 - Starts Immediately Course 3 - Starts After 'Course 2'
3) Learner enrolls to 'Bundle 1'. After enrollment he would see
a) 'Course 1' in 'What am i working' section b) 'Course 2' in available Soon section with a message that it will start after 'Course 1' and that 'Course 2' belongs to 'Bundle 1'
4) Now the Learner enrolls to 'Bundle 2'. After enrollment he would see
a) 'Course 1' continues to appear in 'What am i working' section' b) 'Course 2' will appear in 'What am I working section" and it will get attached to 'Bundle 2'. c) 'Course 3' in available soon section with message that it will start after 'Course 2' and that 'Course 3' belongs to 'Bundle 2'.
In other words, below is the additional logic that we will apply when user enrolls to a bundle Note: Assume that bundle that user is currently being enrolled into is called “NEW BUNDLE” 1) For each Item in the bundle do the following 2) Check if the item was already enrolled by the current user as part of a different bundle (Assume that this different bundle is called “OLD BUNDLE”) 3) IF YES THEN
IF the rule for the item in "NEW BUNDLE" is 'Starts immediately' THEN attach the existing enrollment of the item to the 'NEW BUNDLE'. ELSE IF the rule for the item in "NEW BUNDLE" is 'Start after Product' and the rule in 'OLD BUNDLE' is 'Beginning' THEN attach the existing enrollment of the item to 'NEW BUNDLE' ELSE The item remains attached with 'OLD BUNDLE'.
4) IF NO then do what we are currently doing (no change in behavior)
In short if an item was already enrolled as part of different bundle and the user tries to enroll to another bundle having same item then we override the rules of existing enrollment by comparing the rule of existing enrollment and the new enrollment. The priority of over riding a rule is 1. Starts Immediately 2) Start After Product 3) Beginning