Skip to content

Commit

Permalink
refactor(LimitTrailFields): ♻️ Use closedG where possible
Browse files Browse the repository at this point in the history
  • Loading branch information
SkepticMystic committed Jan 29, 2022
1 parent 51203f9 commit 9263cb0
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/Views/TrailView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,24 @@ import { getFields, getOppDir, getOppFields } from "../Utils/HierUtils";
import { createJugglTrail } from "../Visualisations/Juggl";

function getLimitedTrailSub(plugin: BCPlugin) {
const { settings, mainG } = plugin;
const { settings, mainG, closedG } = plugin;
const { limitTrailCheckboxes, userHiers } = settings;
let subGraph: MultiGraph;

if (
getFields(userHiers).every((field) => limitTrailCheckboxes.includes(field))
) {
subGraph = getSubInDirs(mainG, "up", "down");
return getSubInDirs(closedG, "up");
} else {
const oppFields = limitTrailCheckboxes
.map((field) => getOppFields(userHiers, field, "up")?.[0])
.filter((field) => field !== undefined);
subGraph = getSubForFields(mainG, [...limitTrailCheckboxes, ...oppFields]);
const subGraph = getSubForFields(mainG, [
...limitTrailCheckboxes,
...oppFields,
]);
const closed = getReflexiveClosure(subGraph, userHiers);
return getSubInDirs(closed, "up");
}

const closed = getReflexiveClosure(subGraph, userHiers);
return getSubInDirs(closed, "up");
}

function getBreadcrumbs(
Expand Down

0 comments on commit 9263cb0

Please sign in to comment.