Skip to content

Commit

Permalink
Merge branch 'hannacol/rework_drill_screens' of https://github.com/Go…
Browse files Browse the repository at this point in the history
…lf-Drill-Challenge-App/Golf-App into hannacol/rework_drill_screens
  • Loading branch information
hannacol committed Apr 11, 2024
2 parents 6e89e23 + bd8ed8f commit fc9c9af
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions Utility.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,9 @@ export function numTrunc(value, pad = false) {

export function getUnique(array, field, drills) {
const unique = [];
array.forEach((element) => {
const keyValue = element[field];
const drill = drills.find((item) => item.did === keyValue);
const idx = unique.findIndex((item) => item.did === keyValue);
if (idx === -1) {
unique.push(drill);
}
drills.forEach((drillInfo) => {
const idx = array.findIndex((item) => item["did"] === drillInfo["did"]);
if (idx >= 0) unique.push(drills[idx]);
});
return unique;
}
Expand Down

0 comments on commit fc9c9af

Please sign in to comment.