Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat: Add rerouting to AssignmentReasonRecorder #19252

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 13 commits into
base: main
Choose a base branch
from

Conversation

joeauyeung
Copy link
Contributor

@joeauyeung joeauyeung commented Feb 12, 2025

What does this PR do?

  • When booking is rerouted we record the assignment reason

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • I have updated the developer docs in /docs if this PR makes changes that would require a documentation change. If N/A, write N/A here and check the checkbox.
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

How should this be tested?

  • Create a routed booking
  • Reroute the booking
    • Assignment reason should be recorded

@joeauyeung joeauyeung requested a review from a team as a code owner February 12, 2025 04:54
@graphite-app graphite-app bot requested a review from a team February 12, 2025 04:55
@keithwillcode keithwillcode added consumer core area: core, team members only labels Feb 12, 2025
@dosubot dosubot bot added bookings area: bookings, availability, timezones, double booking ✨ feature New feature or request labels Feb 12, 2025
Copy link

graphite-app bot commented Feb 12, 2025

Graphite Automations

"Add consumer team as reviewer" took an action on this PR • (02/12/25)

1 reviewer was added to this PR based on Keith Williams's automation.

Copy link

vercel bot commented Feb 12, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
cal-com-ui-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 31, 2025 9:36pm
2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
cal ⬜️ Ignored (Inspect) Visit Preview Mar 31, 2025 9:36pm
calcom-web-canary ⬜️ Ignored (Inspect) Visit Preview Mar 31, 2025 9:36pm

@@ -467,6 +469,7 @@ const NewRoutingManager = ({
// TODO: Long term, we should refactor handleNewBooking and use a different route specific for this purpose,
createBookingMutation.mutate({
rescheduleUid: booking.uid,
rescheduledBy: session?.data?.user?.email,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Need to track who is calling the reroute

Comment on lines +16 to +17
isRerouting,
reroutedByEmail,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can reuse the logic that we use when recording the initial routing. That way we can see what attributes changed.

Copy link
Contributor

E2E results are ready!

Copy link
Contributor

github-actions bot commented Mar 1, 2025

This PR is being marked as stale due to inactivity.

@github-actions github-actions bot added the Stale label Mar 1, 2025
emrysal
emrysal previously approved these changes Mar 31, 2025
Copy link
Contributor

@emrysal emrysal left a comment

Choose a reason for hiding this comment

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

Happy with this, LGTM

Copy link
Contributor

This PR is being marked as stale due to inactivity.

@github-actions github-actions bot added the Stale label Apr 16, 2025
@github-actions github-actions bot removed the Stale label Apr 25, 2025
@@ -469,6 +471,7 @@ const NewRoutingManager = ({
// TODO: Long term, we should refactor handleNewBooking and use a different route specific for this purpose,
createBookingMutation.mutate({
rescheduleUid: booking.uid,
rescheduledBy: session?.data?.user?.email ?? undefined,
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't we error early if session is nullish, because rerouting can't be done by a non-logged in user.

Doing this change make it feel like non-logged in user could do re-routing

Comment on lines +112 to +123
const userQuery = await prisma.user.findFirst({
where: {
email: reroutedByEmail,
},
select: {
id: true,
},
});

if (userQuery) {
reroutedByUserId = userQuery.id;
}
Copy link
Member

Choose a reason for hiding this comment

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

We should use UserRepository

reasonString: attributeValues.join(", "),
reasonEnum: isRerouting ? AssignmentReasonEnum.REROUTED : AssignmentReasonEnum.ROUTING_FORM_ROUTING,
reasonString: `${
reroutedByUserId ? `Rerouted by user: ${reroutedByUserId}` : ""
Copy link
Member

Choose a reason for hiding this comment

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

As this reason would be shown to users, so maybe we should show the email here?

Copy link
Member

@hariombalhara hariombalhara left a comment

Choose a reason for hiding this comment

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

Left some comments, overall looks good.

Also, CI is failing a lot of checks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bookings area: bookings, availability, timezones, double booking consumer core area: core, team members only ✨ feature New feature or request ready-for-e2e routing-forms area: routing forms, routing, forms
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants