Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Students courses in Schoolworks are represented by a Course Id, Start Date and End date.

We store the student’s course booking in an object called Booking__c

Student Courses might look like:

Booking__c

Student Id

Course Id

Start Date

End Date

Status

1234

1

25/3/24

19/4/24

Booked

2345

1

5/2/24

21/3/24

Booked

3456

1

3/1/24

13/11/24

Booked

4567

1

13/2/24

10/10/24

Cancelled

5678

1

26/3/24

28/3/24

Booked

5678

2

27/3/24

29/3/24

Booked

Each booking has a status - ‘Booked’ and ‘Cancelled’.

...

Please write a Salesforce Apex method, with input parameters - periodStartDate, periodEndDate, that returns a list of unique students Ids 'here' across the period, from the object Booking__c, which has the fields, Student_Id, Course_Id, Booking_Start_Date__c, Booking_End_Date__c, Status__c. where Booking Start/End dates are across PeriodStart/End dates and Status = "Booked".

Please demonstrate development best practices, including considerations for NULL, Error management, validation, comments and anything else you consider to be important in your submission.Imagine this code, has to work, like a rocket launched to the moon.


Extension task

Additionally, please exclude any students from the list, who may be on holiday, every day, across the whole periodStartDate, periodEndDate.

...