-
Notifications
You must be signed in to change notification settings - Fork 1.1k
WIP: response time tracking #939
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
base: feat/outlook-sub-history
Are you sure you want to change the base?
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. 🗂️ Base branches to auto review (2)
Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3 issues found across 1 file
Prompt for AI agents (all 3 issues)
Understand the root cause of the following 3 issues and fix them.
<file name="apps/web/app/api/user/stats/response-time/route.ts">
<violation number="1" location="apps/web/app/api/user/stats/response-time/route.ts:106">
The received filter compares against the recipient address, so the customer's reply is excluded and your own outbound message is treated as inbound; switch to the sender address so we keep actual customer responses.</violation>
<violation number="2" location="apps/web/app/api/user/stats/response-time/route.ts:118">
This filter also checks against the recipient address, so inbound replies are treated as your own outbound messages; use the sender address to capture actual user-sent mail.</violation>
<violation number="3" location="apps/web/app/api/user/stats/response-time/route.ts:255">
Guard the previous-period recursion when `differenceInDays` returns 0 (same-day range); otherwise this calls itself with identical parameters and recurses forever.</violation>
</file>
React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai to give feedback, ask questions, or re-run the review.
| const previousFromDate = subDays(new Date(fromDate), currentPeriodDays); | ||
| const previousToDate = new Date(fromDate); | ||
|
|
||
| const previousPeriodStats = await getResponseTimeStats({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Guard the previous-period recursion when differenceInDays returns 0 (same-day range); otherwise this calls itself with identical parameters and recurses forever.
Prompt for AI agents
Address the following comment on apps/web/app/api/user/stats/response-time/route.ts at line 255:
<comment>Guard the previous-period recursion when `differenceInDays` returns 0 (same-day range); otherwise this calls itself with identical parameters and recurses forever.</comment>
<file context>
@@ -0,0 +1,309 @@
+ const previousFromDate = subDays(new Date(fromDate), currentPeriodDays);
+ const previousToDate = new Date(fromDate);
+
+ const previousPeriodStats = await getResponseTimeStats({
+ fromDate: previousFromDate.getTime(),
+ toDate: previousToDate.getTime(),
</file context>
| .filter( | ||
| (m) => | ||
| m.internalDate && | ||
| m.headers.from?.includes(sentMsg.headers.to || ""), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This filter also checks against the recipient address, so inbound replies are treated as your own outbound messages; use the sender address to capture actual user-sent mail.
Prompt for AI agents
Address the following comment on apps/web/app/api/user/stats/response-time/route.ts at line 118:
<comment>This filter also checks against the recipient address, so inbound replies are treated as your own outbound messages; use the sender address to capture actual user-sent mail.</comment>
<file context>
@@ -0,0 +1,309 @@
+ .filter(
+ (m) =>
+ m.internalDate &&
+ m.headers.from?.includes(sentMsg.headers.to || ""),
+ )
+ .sort(
</file context>
| .filter( | ||
| (m) => | ||
| m.internalDate && | ||
| !m.headers.from?.includes(sentMsg.headers.to || ""), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The received filter compares against the recipient address, so the customer's reply is excluded and your own outbound message is treated as inbound; switch to the sender address so we keep actual customer responses.
Prompt for AI agents
Address the following comment on apps/web/app/api/user/stats/response-time/route.ts at line 106:
<comment>The received filter compares against the recipient address, so the customer's reply is excluded and your own outbound message is treated as inbound; switch to the sender address so we keep actual customer responses.</comment>
<file context>
@@ -0,0 +1,309 @@
+ .filter(
+ (m) =>
+ m.internalDate &&
+ !m.headers.from?.includes(sentMsg.headers.to || ""),
+ )
+ .sort(
</file context>
No description provided.