Hello everyone,
Description:
The logic for a customer for the consultation is always 'type Q' then 'type A' and so on (Q=Question, A=Answer). When a customer has Q AND Appointment_date = null, then count the time between approved_at_ of t Q AND create_date of Type A . sort for date and time so you should always see the QA QA QA
Problem Statment:
I want to fetch Interval between 2 different dates with one customer id.
I have 2 types for one customer type='Q' and 'A'
I need to subtract the approvedat with type Q and message.createdAt.Date with type A where appointment_date for both = Null or 0
The problem is there is no tracking id to say which Q has which A, the only way to look at it is by sorting with respect to message.createdAt date.
If the last cretedat date has type=Q I should not consider it as it doesn't have a A after.
I forgot to mention that all these customers have different lawyers.
A lawyer can have any number of customers but a customer can have only 1 lawyer assigned.
I need to find the average reply time
Please help me with this.
Thank you
Regards,
Neeru