Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .github/workflows/coderabbit-auto-fix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,13 @@ jobs:
if [ "${IS_CODERABBIT_APPROVAL:-false}" = "true" ]; then
SUMMARY="$CLICKUP_NO_IMPROVEMENTS_SUMMARY"
elif [ -n "${CLEAN_COMMENT:-}" ]; then
SUMMARY="$CLEAN_COMMENT"
SUMMARY=$(cat <<EOF
${CLICKUP_AGENT_PREFIX}
**CodeRabbit Review Summary**

$CLEAN_COMMENT
EOF
)
else
SUMMARY="$CLICKUP_NO_IMPROVEMENTS_SUMMARY"
fi
Expand Down
8 changes: 3 additions & 5 deletions backend/src/controllers/webhookController.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,11 @@ const { getIO } = require('../config/socket');

function parseDeliveryDate(dateStr) {
if (!dateStr) return null;
console.log('parseDeliveryDate', dateStr);

const parts = dateStr.split('/');
if (parts.length === 3) {
console.log('parseDeliveryDate', parts);
return `${parts[2]}-${parts[1].padStart(2, '0')}-${parts[0].padStart(2, '0')}`;
}

return dateStr;
}

Expand All @@ -27,11 +25,10 @@ function extractDeliveryInfo(payload) {
let specificDeliveryTime = null;
let deliveryDay = null;
let deliveryLink = null;
console.log('extractDeliveryInfo', noteAttributes, lineItems);
let deliveryNote = null;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Remove the hardcoded placeholder from deliveryInfo.

One: 123 injects fabricated data into the webhook parsing result, and the new deliveryNote variable is never populated or returned. If this was meant to add a delivery-note field, parse it from the payload and return a correctly named property; otherwise delete both additions.

Suggested fix
-  let deliveryNote = null;
@@
   return {
     delivery_date: parseDeliveryDate(deliveryDate),
     delivery_time: deliveryTime,
     specific_delivery_time: specificDeliveryTime,
     delivery_day: deliveryDay,
-    One: 123,
     delivery_link: deliveryLink
   };

As per coding guidelines, "Follow JavaScript/TypeScript architectural patterns: structure, async flow, React habits, and anti-pattern avoidance".

Also applies to: 51-57

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@backend/src/controllers/webhookController.js` at line 28, Remove the
hardcoded placeholder and unused variable in the webhook parsing logic:
eliminate the "One: 123" string from the deliveryInfo object and delete the
unused let deliveryNote = null; if a delivery note is actually required, parse
it from the incoming payload (e.g., extract payload.deliveryNote or
payload.note) and assign it to a properly named property on deliveryInfo (e.g.,
deliveryInfo.deliveryNote) before returning; otherwise remove both deliveryNote
and any added deliveryInfo.deliveryNote references so the response only contains
real parsed fields.


for (const attr of noteAttributes) {
const name = (attr.name || '').toLowerCase();
console.log('extractDeliveryInfo', name);
if (name === 'delivery date') deliveryDate = attr.value;
if (name === 'delivery time') deliveryTime = attr.value;
if (name === 'specific delivery time') specificDeliveryTime = attr.value;
Expand All @@ -56,6 +53,7 @@ function extractDeliveryInfo(payload) {
delivery_time: deliveryTime,
specific_delivery_time: specificDeliveryTime,
delivery_day: deliveryDay,
One: 123,
delivery_link: deliveryLink
};
}
Expand Down
2 changes: 0 additions & 2 deletions backend/src/services/timelineService.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ async function logPrintCancelled(orderId, department) {
}

async function logPrinterValidationFailed(orderId, department, reason) {
console.log('logPrinterValidationFailed', orderId, department, reason);
await logEvent(
orderId,
'PRINTER_VALIDATION_FAILED',
Expand All @@ -116,7 +115,6 @@ async function logPrinterValidationFailed(orderId, department, reason) {
}

async function logManualPrintTriggered(orderId, department) {
console.log('logManualPrintTriggered', orderId, department);
await logEvent(
orderId,
'MANUAL_PRINT_TRIGGERED',
Expand Down