Skip to content

fix: conversation duration set to 0 [CHI-3351] #3027

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

gpaoloni
Copy link
Collaborator

@gpaoloni gpaoloni commented Jun 2, 2025

Description

This PR fixes the bug described in the ticket, where contacts' conversationDuration is always set to zero.
This bug is caused because since the contact is created in the backend, the Flex state initializes the "start timpestamp of conversation" as null.
The fix introduced here uses the contact createdAt timestamp as the start of conversation - since contacts are created in the backend, we are always guaranteed it will exist for the time the contact is loaded.

  • A benefit of this approach is that conversation duration will remain even in the case of page reloads, fixing L4: Conversation duration is incorrect after refresh.
  • This might imply that a small difference might exist between the time the counselor accepts the contact and what is reflected in the conversation duration: the time elapsed between the "reservation accepted" event and the time the backend actually creates the contact in HRM. Is this acceptable?
  • Another implication of this change is that transferred tasks will preserve the entire time elapsed since the contact was created:
    • Counselor A accepts a chat, and keeps it open for 10 minutes.
    • Counselor A transfers the contact to Counselor B.
    • Counselor B accepts the transfer and works on it for another 20 minutes.
    • The final "conversation duration" will be computed as 30 minutes - the time elapsed since the contact creation. Is this desirable?

Checklist

Other Related Issues

None

Verification steps

AFTER YOU MERGE

  1. Cut a release tag using the Github workflow. Wait for it to complete and notify in the #aselo-deploys Slack channel.
  2. Comment on the ticket with the release tag version AND any additional instructions required to configure an environment to test the changes.
  3. Only then move the ticket into the QA column in JIRA

You are responsible for ensuring the above steps are completed. If you move a ticket into QA without advising what version to test, the QA team will assume the latest tag has the changes. If it does not, the following confusion is on you! :-P

@gpaoloni gpaoloni requested review from stephenhand and mythilytm June 2, 2025 21:55
@gpaoloni gpaoloni marked this pull request as ready for review June 2, 2025 21:55
Copy link
Collaborator

@stephenhand stephenhand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants