Skip to content

Commit

Permalink
fix: tolowercase
Browse files Browse the repository at this point in the history
  • Loading branch information
dadiorchen committed Apr 7, 2022
1 parent 7587a06 commit 075c581
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions server/models/Earnings.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,15 +185,21 @@ class Earnings {
}

if (filter?.grower) {
formattedEarnings = formattedEarnings.filter(({ grower }) =>
grower.toLowerCase().includes(filter?.grower.toLowerCase()),
);
formattedEarnings = formattedEarnings.filter(({ grower }) => {
if (!grower) {
return false;
}
return grower.toLowerCase().includes(filter?.grower.toLowerCase());
});
}

if (filter?.phone) {
formattedEarnings = formattedEarnings.filter(({ phone }) =>
phone.toLowerCase().includes(filter?.phone.toLowerCase()),
);
formattedEarnings = formattedEarnings.filter(({ phone }) => {
if (!phone) {
return false;
}
return phone.toLowerCase().includes(filter?.phone.toLowerCase());
});
}

// after grower and phone filters have been applied
Expand Down

0 comments on commit 075c581

Please sign in to comment.