'start_time__c field of custom object is not working in trigger i don't no what to do?

I have to do this:-

If an attendee has registered to parallel sessions (Sessions happening at the same time/overlapping sessions), then a checkbox (Registered_To_Parallel_Sessions__c) on the Attendee(Lead) object must be checked automatically.

This is my trigger:-

trigger RegisteredToParallelSession on Session_Attendee__c (after insert,before insert) {
 
list<session_attendee__C>  sa2 = [select attendee__c, session__c, session__r.id,session__r.name, session__r.Start_Time__c from Session_attendee__c];
list<lead> l = [select id, Registered_To_Parallel_Session__c from lead];
list<session__c> s = [select id, start_time__c from session__c];


for(session_attendee__c sa4 : trigger.new){
                for(session__c s2 : s){
                     for(lead l1 : l){
                            if(l1.Id == sa4.Attendee__c && s2.id == sa4.session__c && s2.Start_Time__c == sa4.session__r.Start_Time__c ) // this condition is not working
                          {
                                l1.Registered_To_Parallel_Session__c = true;
                                update l1;
                          } 
                        }
        
                   }
            }
    }

This if(sa4.session__c && s2.Start_Time__c == sa4.session__r.Start_Time__c ) condition in above code is not working please help & Thanks!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source