Skip to content

Commit

Permalink
update methods for applicability
Browse files Browse the repository at this point in the history
  • Loading branch information
anjanaw committed Feb 7, 2024
1 parent aa5667f commit 473f91d
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/controllers/trees.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,22 +96,20 @@ module.exports.methods = async (req, res) => {
}
};
const appResponse = await axios(config);
console.log("applicabilities", appResponse.data);
const data = await Tree.findById(requestData.treeId);
if (data) {
let methods = []
let apps = {}
let _methods = []
let _apps = {}
data.data.trees.forEach(t => {
for (var n in t.nodes) {
if (t.nodes[n].Concept == "Explanation Method") {
methods.push(t.nodes[n].Instance);
apps[t.nodes[n].Instance] = appResponse.data[t.nodes[n].Instance];
_methods.push(t.nodes[n].Instance);
_apps[t.nodes[n].Instance] = appResponse.data[t.nodes[n].Instance];
}
}
});
console.log("methods", methods);
console.log("apps", apps);
res.status(200).json({"methods": methods, "applicabilities":applicabilities});
const returnData = {methods: _methods, applicabilities:_apps};
res.status(200).json(returnData);
} else {
res.status(404).json({ message: "not found" });
}
Expand Down

0 comments on commit 473f91d

Please sign in to comment.