Skip to content

Fix - Scan receipt - Red dot missing on LHN after receipt edit & submit with higher Amount #60867

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

Closed
wants to merge 4 commits into from
Closed
Changes from 1 commit
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
24 changes: 12 additions & 12 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -816,7 +816,7 @@ type GetReportNameParams = {
policies?: SearchPolicy[];
};

type ReportByPolicyMap = Record<string, Report[]>;
type ReportByPolicyMap = Record<string, string[]>;

let currentUserEmail: string | undefined;
let currentUserPrivateDomain: string | undefined;
Expand Down Expand Up @@ -888,7 +888,7 @@ Onyx.connect({
});

let allReports: OnyxCollection<Report>;
let reportsByPolicyID: ReportByPolicyMap;
let reportIDsByPolicyID: ReportByPolicyMap;
Onyx.connect({
key: ONYXKEYS.COLLECTION.REPORT,
waitForCollectionCallback: true,
Expand All @@ -905,7 +905,7 @@ Onyx.connect({
return;
}

reportsByPolicyID = Object.values(value).reduce<ReportByPolicyMap>((acc, report) => {
reportIDsByPolicyID = Object.values(value).reduce<ReportByPolicyMap>((acc, report) => {
if (!report) {
return acc;
}
Expand All @@ -914,13 +914,13 @@ Onyx.connect({

// Get all reports, which are the ones that are:
// - Owned by the same user
// - Are either open or submitted
// - Are not settled.
// - Belong to the same workspace
if (report.policyID && report.ownerAccountID === currentUserAccountID && (report.stateNum ?? 0) <= 1) {
if (report.policyID && report.ownerAccountID === currentUserAccountID && !isSettled(report)) {
if (!acc[report.policyID]) {
acc[report.policyID] = [];
}
acc[report.policyID].push(report);
acc[report.policyID].push(report.reportID);
}

return acc;
Expand Down Expand Up @@ -7497,17 +7497,17 @@ function shouldDisplayViolationsRBRInLHN(report: OnyxEntry<Report>, transactionV
if (!isCurrentUserSubmitter(report.reportID)) {
return false;
}
if (!report.policyID || !reportsByPolicyID) {
if (!report.policyID || !reportIDsByPolicyID) {
return false;
}

// If any report has a violation, then it should have a RBR
const potentialReports = reportsByPolicyID[report.policyID] ?? [];
return potentialReports.some((potentialReport) => {
const potentialReportIDs = reportIDsByPolicyID[report.policyID] ?? [];
return potentialReportIDs.some((reportID) => {
return (
hasViolations(potentialReport.reportID, transactionViolations, true) ||
hasWarningTypeViolations(potentialReport.reportID, transactionViolations, true) ||
hasNoticeTypeViolations(potentialReport.reportID, transactionViolations, true)
hasViolations(reportID, transactionViolations, true) ||
hasWarningTypeViolations(reportID, transactionViolations, true) ||
hasNoticeTypeViolations(reportID, transactionViolations, true)
);
});
}
Expand Down
Loading