Skip to content

Commit

Permalink
Reduce my 4$$
Browse files Browse the repository at this point in the history
  • Loading branch information
demmings committed Apr 7, 2024
1 parent 4fe27dc commit 1c2cb39
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
10 changes: 5 additions & 5 deletions coverage/tests.lcov
Original file line number Diff line number Diff line change
Expand Up @@ -788,8 +788,8 @@ BRDA:175,26,0,44
BRDA:176,27,0,10
BRDA:176,28,0,34
BRDA:180,29,0,12
BRDA:178,30,0,22
BRDA:178,31,0,38
BRDA:178,30,0,44
BRDA:178,31,0,76
BRDA:193,32,0,122
BRDA:196,33,0,647
BRDA:199,34,0,658
Expand Down Expand Up @@ -15885,9 +15885,9 @@ BRDA:171,29,0,370
BRDA:182,30,0,370
BRDA:185,31,0,35
BRDA:188,32,0,335
BRDA:186,33,0,37
BRDA:186,34,0,351
BRDA:189,35,0,11
BRDA:186,33,0,72
BRDA:186,34,0,682
BRDA:189,35,0,346
BRDA:200,36,0,418
BRDA:209,37,0,41
BRDA:209,38,0,374
Expand Down
6 changes: 3 additions & 3 deletions dist/gssql.js
Original file line number Diff line number Diff line change
Expand Up @@ -1950,10 +1950,10 @@ class SelectTables {
let results = [];

if (logic === "AND") {
results = recordIDs.reduce((a, b) => a.filter(c => b.includes(c)));
results = recordIDs.reduce((a, b) => a.filter(c => b.includes(c)), recordIDs[0]);
}
if (logic === "OR") {
results = Array.from(new Set(recordIDs.reduce((a, b) => a.concat(b))));
results = Array.from(new Set(recordIDs.reduce((a, b) => a.concat(b), recordIDs[0])));
}

return results;
Expand Down Expand Up @@ -5168,7 +5168,7 @@ class JoinTables { // skipcq: JS-0128
for (const rec of recIds) {
temp.push(typeof rec[i] === 'undefined' ? [] : rec[i]);
}
const row = temp.reduce((a, b) => a.filter(c => b.includes(c)));
const row = temp.reduce((accumulator, currentRecords) => accumulator.filter(c => currentRecords.includes(c)), temp[0]);

if (row.length > 0) {
result[i] = row;
Expand Down
2 changes: 1 addition & 1 deletion src/JoinTables.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ class JoinTables { // skipcq: JS-0128
for (const rec of recIds) {
temp.push(typeof rec[i] === 'undefined' ? [] : rec[i]);
}
const row = temp.reduce((a, b) => a.filter(c => b.includes(c)));
const row = temp.reduce((accumulator, currentRecords) => accumulator.filter(c => currentRecords.includes(c)), temp[0]);

if (row.length > 0) {
result[i] = row;
Expand Down
4 changes: 2 additions & 2 deletions src/Views.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,10 @@ class SelectTables {
let results = [];

if (logic === "AND") {
results = recordIDs.reduce((a, b) => a.filter(c => b.includes(c)));
results = recordIDs.reduce((a, b) => a.filter(c => b.includes(c)), recordIDs[0]);
}
if (logic === "OR") {
results = Array.from(new Set(recordIDs.reduce((a, b) => a.concat(b))));
results = Array.from(new Set(recordIDs.reduce((a, b) => a.concat(b), recordIDs[0])));
}

return results;
Expand Down

0 comments on commit 1c2cb39

Please sign in to comment.