Skip to content

Commit

Permalink
fix: removeDuplicateImplied
Browse files Browse the repository at this point in the history
  • Loading branch information
SkepticMystic committed Jul 15, 2021
1 parent 280412c commit c6379c2
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions src/MatrixView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,20 +90,20 @@ export default class MatrixView extends ItemView {
// ANCHOR Remove duplicate implied links

removeDuplicateImplied(
real: internalLinkObj[],
implied: internalLinkObj[]
): void {
const impliedTos: [string, number][] = implied.map((impliedObj, i) => [
impliedObj.to,
i,
]);
real.forEach((realItem) => {
impliedTos.forEach((impliedTo) => {
if (impliedTo[0] === realItem.to) {
implied.splice(impliedTo[1], 1);
}
});
});
reals: internalLinkObj[],
implieds: internalLinkObj[]
): internalLinkObj[] {
// const noDuplicatesImplieds = implieds;
// reals.forEach(real => {
// implieds.forEach((implied, i) => {
// if (implied.to === real.to) {
// noDuplicatesImplieds.slice(i, 1)
// }
// })
// });

const noDuplicates = implieds.filter(implied => !reals.map(real => real.to).includes(implied.to))
return noDuplicates
}

dfsAllPaths(g: Graph, startNode: string): string[][] {
Expand Down Expand Up @@ -200,7 +200,7 @@ export default class MatrixView extends ItemView {
];


const [
let [
realParents,
realSiblings,
realChildren,
Expand All @@ -218,7 +218,7 @@ export default class MatrixView extends ItemView {
/// Notes with the same parents
const currParents = (gParents.successors(currFile.basename) ??
[]) as string[];
const impliedSiblingsArr: internalLinkObj[] = [];
let impliedSiblingsArr: internalLinkObj[] = [];

if (currParents.length) {
currParents.forEach((parent) => {
Expand All @@ -245,9 +245,9 @@ export default class MatrixView extends ItemView {

// !SECTION

this.removeDuplicateImplied(realParents, impliedParents);
this.removeDuplicateImplied(realSiblings, impliedSiblingsArr);
this.removeDuplicateImplied(realChildren, impliedChildren);
impliedParents = this.removeDuplicateImplied(realParents, impliedParents);
impliedSiblingsArr = this.removeDuplicateImplied(realSiblings, impliedSiblingsArr);
impliedChildren = this.removeDuplicateImplied(realChildren, impliedChildren);

debug(settings, { realParents, impliedParents, realSiblings, impliedSiblingsArr, realChildren, impliedChildren })

Expand Down

0 comments on commit c6379c2

Please sign in to comment.