Skip to content

Conversation

@AmandeepMandal1077
Copy link

No description provided.

@Copilot Copilot AI review requested due to automatic review settings October 10, 2025 19:54
@netlify
Copy link

netlify bot commented Oct 10, 2025

Deploy Preview for paisable ready!

Name Link
🔨 Latest commit d56bee1
🔍 Latest deploy log https://app.netlify.com/projects/paisable/deploys/68f9074121a67100083e6e56
😎 Deploy Preview https://deploy-preview-117--paisable.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 93
Accessibility: 100
Best Practices: 100
SEO: 91
PWA: 80
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds editing functionality for OCR extracted receipt data, allowing users to review and modify the extracted information before saving it as a transaction. The implementation introduces a two-step process: first extracting data from the receipt, then allowing user verification/editing before final save.

Key changes:

  • Separated receipt processing from transaction creation with a confirmation step
  • Added modal-based editing interface for extracted receipt data
  • Implemented new backend endpoint for saving user-confirmed transactions

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
frontend/src/pages/ReceiptsPage.jsx Added editing modal, confirmation UI, and two-step transaction creation workflow
backend/routes/receiptRoutes.js Added new route for saving confirmed transactions
backend/controllers/receiptController.js Removed automatic transaction creation and added endpoint for user-confirmed transaction saving

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.


const savedTransaction = await newTransaction.save();

// update the receipt with the final confirmed data
Copy link

Copilot AI Oct 10, 2025

Choose a reason for hiding this comment

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

Corrected capitalization: 'update' should be 'Update' at the beginning of the comment.

Suggested change
// update the receipt with the final confirmed data
// Update the receipt with the final confirmed data

Copilot uses AI. Check for mistakes.
Comment on lines 68 to 88
const handleEditReceiptSubmit = async (formData, transactionId) => {
try {
// Update the receiptResult with the edited data
const updatedReceiptResult = {
...receiptResult,
extractedData: {
merchant: formData.name,
amount: parseFloat(formData.cost),
category: formData.category,
date: formData.addedOn,
isIncome: formData.isIncome
}
};

setReceiptResult(updatedReceiptResult);
setOpenEditReceiptResult(false);
} catch (err) {
setError('Failed to update receipt data. Please try again.');
console.error(err);
}
};
Copy link

Copilot AI Oct 10, 2025

Choose a reason for hiding this comment

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

The function parameter transactionId is not used anywhere in the function body. Either remove it or implement the intended functionality that uses this parameter.

Copilot uses AI. Check for mistakes.
@AmandeepMandal1077
Copy link
Author

what i have done is like,
when user upload a receipt, user have to explicitly click on 'Save Transaction to continue.

@AmandeepMandal1077
Copy link
Author

@archa8 could you please review this PR when you get a chance.

@Copilot Copilot AI review requested due to automatic review settings October 22, 2025 16:05
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines 68 to 87
const handleEditReceiptSubmit = async (formData) => {
try {
// Update the receiptResult with the edited data
const updatedReceiptResult = {
...receiptResult,
extractedData: {
merchant: formData.name,
amount: parseFloat(formData.cost),
category: formData.category,
date: formData.addedOn,
isIncome: formData.isIncome
}
};

setReceiptResult(updatedReceiptResult);
setOpenEditReceiptResult(false);
} catch (err) {
setError('Failed to update receipt data. Please try again.');
console.error(err);
}
Copy link

Copilot AI Oct 22, 2025

Choose a reason for hiding this comment

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

The function is marked as async but does not contain any await operations. Since it only performs synchronous state updates, the try-catch block will not catch errors from asynchronous operations that don't exist. Remove the async keyword and consider removing the try-catch block as synchronous state updates are unlikely to throw errors.

Suggested change
const handleEditReceiptSubmit = async (formData) => {
try {
// Update the receiptResult with the edited data
const updatedReceiptResult = {
...receiptResult,
extractedData: {
merchant: formData.name,
amount: parseFloat(formData.cost),
category: formData.category,
date: formData.addedOn,
isIncome: formData.isIncome
}
};
setReceiptResult(updatedReceiptResult);
setOpenEditReceiptResult(false);
} catch (err) {
setError('Failed to update receipt data. Please try again.');
console.error(err);
}
const handleEditReceiptSubmit = (formData) => {
// Update the receiptResult with the edited data
const updatedReceiptResult = {
...receiptResult,
extractedData: {
merchant: formData.name,
amount: parseFloat(formData.cost),
category: formData.category,
date: formData.addedOn,
isIncome: formData.isIncome
}
};
setReceiptResult(updatedReceiptResult);
setOpenEditReceiptResult(false);

Copilot uses AI. Check for mistakes.
<p className="text-gray-700 dark:text-gray-300"><strong>Date:</strong> {new Date(receiptResult.extractedData.date).toLocaleDateString()}</p>
<div className="mb-4">
<p className="text-gray-700 dark:text-gray-300"><strong>Merchant:</strong> {receiptResult.extractedData.merchant}</p>
<p className="text-gray-700 dark:text-gray-300"><strong>Amount:</strong> {receiptResult.extractedData.amount.toFixed(2)}</p>
Copy link

Copilot AI Oct 22, 2025

Choose a reason for hiding this comment

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

Potential runtime error if receiptResult.extractedData.amount is null or undefined. Since the amount comes from user-edited data and parseFloat can return NaN, consider adding a fallback: {(receiptResult.extractedData.amount || 0).toFixed(2)}

Suggested change
<p className="text-gray-700 dark:text-gray-300"><strong>Amount:</strong> {receiptResult.extractedData.amount.toFixed(2)}</p>
<p className="text-gray-700 dark:text-gray-300"><strong>Amount:</strong> {(parseFloat(receiptResult.extractedData.amount) || 0).toFixed(2)}</p>

Copilot uses AI. Check for mistakes.
name: transactionData.name,
category: transactionData.category,
cost: transactionData.cost,
addedOn: new Date(transactionData.addedOn),
Copy link

Copilot AI Oct 22, 2025

Choose a reason for hiding this comment

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

If transactionData.addedOn is an invalid date string, new Date() will create an Invalid Date object, which could cause issues downstream. Add validation to ensure the date is valid before creating the transaction.

Copilot uses AI. Check for mistakes.
@AmandeepMandal1077
Copy link
Author

@archa8 could you please review this pr again, for any issues.

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.

1 participant