Skip to content

Commit

Permalink
feat: use Default build if the specified build inst present
Browse files Browse the repository at this point in the history
  • Loading branch information
seankwarren committed Dec 14, 2023
1 parent 457708a commit 4371d12
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/js/models.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,27 +49,35 @@ export function getFilterObjects({
flavor = "",
}) {
let filterList;

// use previous version when the filterTree does not contain the version specified
const version_ = safelyGet(filterTree, appName, version)
? version
: getPreviousVersion(filterTree[appName], version);

// use Default build when the filterTree does not contain the build specified
const build_ =
!safelyGet(filterTree, appName, version_, build) &&
safelyGet(filterTree, appName, version_, "Default")
? "Default"
: build;
if (!appName) {
filterList = mergeTerminalNodes(filterTree);
} else if (!version_) {
filterList = mergeTerminalNodes(safelyGet(filterTree, appName));
} else if (!build) {
} else if (!build_) {
const branch =
safelyGet(filterTree, appName, version_) ||
getPreviousVersion(filterTree[appName], version_);
filterList = mergeTerminalNodes(branch);
} else if (!executable) {
filterList = mergeTerminalNodes(safelyGet(filterTree, appName, version_, build));
filterList = mergeTerminalNodes(safelyGet(filterTree, appName, version_, build_));
} else if (!flavor) {
filterList = mergeTerminalNodes(
safelyGet(filterTree, appName, version_, build, executable),
safelyGet(filterTree, appName, version_, build_, executable),
);
} else {
filterList = safelyGet(filterTree, appName, version_, build, executable, flavor);
filterList = safelyGet(filterTree, appName, version_, build_, executable, flavor);
}

return [].concat(extractUniqueBy(filterList, "path"), extractUniqueBy(filterList, "regex"));
Expand Down

0 comments on commit 4371d12

Please sign in to comment.