sgoEma / EventManagement

0 stars 1 forks source link

Multiple Speakers for Sessions #33

Open sgoEma opened 2 years ago

sgoEma commented 2 years ago

1 speaker may not be enough for all the sessions. The speakers should not be attended to the multiple sessions if the sessions are at the same time.

sgoEma commented 2 years ago

SP: 5

bmtemakina commented 2 years ago

Issues for this ticket:

Issue_1: Session can be defined with multiple Speakers and also Speaker can attend multiple sessions.

  1. To establish a many-to-many relationship between Session and Speaker we can create an object called "Speaker Registrations" which has a master-detail relationship for both Speaker and Session.

Issue_2: Speakers can't attend to Sessions which overlap and for this reason restrict users to register Speakers to overlapping Sessions.

  1. We can define a "Before Save Record Triggered Flow" for the Speaker Registration object and add an invisible field to be triggered by flow and can perform the following steps in the flow.

    1. Get Related Speakers Registration records.
    2. Loop over them and check if the session is overlapping by checking the date/time fields.

      • If the Session is overlapping, then trigger a validation rule.
      • Else continue with other validations or save the record.
  2. We can create an Apex Trigger for the Speaker Registration object.

    1. Create a handler for the object and insert a onBeforeInsert() method into it.
    2. Call the onBeforeInsert() method with the Apex trigger.
    3. Inside the onBeforeInsert() method write a SOQL query for getting the overlapping Sessions and store them in a list or map.
    4. Check if the list or map contains any value or not.
      • If the list or map is empty, then save the record.
      • Else reject the record because it is overlapping.

Issue_3: Speakers' Sessions must be at least 1 hour away from each other. If not Speaker Registration record must be rejected.

  1. While checking for overlapping Sessions we can set the Session start date/time to 1 hour early.

sercanEmakina commented 2 years ago

@bmtemakina 1) could you please consider/think what needs to be done if we use "session registration" objet instead of creating a new one named "speaker registrations" and add your solution approach to the ticket by posting a new comment?

2) could you please elaborate the solution for issue 3? can you provide an example ?

bmtemakina commented 2 years ago

@sercanEmakina @sgoEma

  1. If we use "Session Registration" object we can do following steps

    • Create two record type called "Speaker Registration" and "Attendee Registration" for the Session Registration object.
    • Update the Attendee lookup filter to list correct records based on the Session Registration's record type
    • We can exclude Speaker type Session Registration from IsEventRegistered check.
    • In Session Registration Validations Flow we need to check for record type and make new decisions, because Speaker Session Registration Validations has different requirements from Attendee Session Registration Validations.
    • If Speakers will be excluded from attendee count, we need to update the roll up summary field's criteria on Session Object
  2. For example a User wants to create a Speaker Session Registration object with the Start Date/time as 01/01/2022 : 1.00pm and End Date/time as 01/01/2022: 2.00p. When we are validating this registration we can set record's Start and End Date/time as 01/01/2022 : 12:00pm - 01/01/2022 : 3.00pm and with this, we can make sure there will be at least one hour between Speaker's Sessions.

sgoEma commented 2 years ago

@bmtemakina

Thanks for the solution design and analysis. I want to add some small details:

Can you please proceed with the existing object for this ticket?

bmtemakina commented 2 years ago

@bmtemakina

Thanks for the solution design and analysis. I want to add some small details:

  • Contact Field name is "Attendee" on Session Registration. I think its name should also be changed.
  • Session capacity should be tested after the changes are done.

Can you please proceed with the existing object for this ticket?

Okay, I'm on it.