mirror of
https://gitlab.com/wgp/dougal/software.git
synced 2025-12-06 11:07:08 +00:00
Remove dead code
This commit is contained in:
@@ -1,27 +1,5 @@
|
||||
const { setSurvey } = require('../connection');
|
||||
|
||||
function thinout (key, obj) {
|
||||
const path = key.split(".");
|
||||
// console.log("path", path);
|
||||
const value = path.reduce( (a, b, i) => {
|
||||
// console.log("index", i);
|
||||
if (a !== null && typeof a != "undefined") {
|
||||
if (b == "*" && Array.isArray(a)) {
|
||||
const subkey = path.splice(i+1).join(".");
|
||||
console.log("subkey", subkey);
|
||||
return a.map(e => thinout(subkey, e));
|
||||
} else {
|
||||
// console.log("key", b, "value", a);
|
||||
return a[b];
|
||||
}
|
||||
} else {
|
||||
// console.log("null or undef");
|
||||
return a;
|
||||
}
|
||||
}, obj);
|
||||
return value;
|
||||
}
|
||||
|
||||
async function getSummary (projectId, sequence, opts = {}) {
|
||||
const client = await setSurvey(projectId);
|
||||
|
||||
@@ -84,25 +62,6 @@ async function get (projectId, sequence, opts = {}) {
|
||||
return res.rows.map( r =>
|
||||
Object.fromEntries(Object.entries(r).filter(entry => project.includes(entry[0])))
|
||||
);
|
||||
// const deep = tokens.filter(i => i.includes("."));
|
||||
// console.log("tokens", tokens, "project", project, "deep", deep);
|
||||
// if (deep.length) {
|
||||
// return res.rows.map( r => {
|
||||
// const o = Object.fromEntries(Object.entries(r).filter(entry => project.includes(entry[0])))
|
||||
// deep.forEach(path => {
|
||||
// console.log("path", path, path.split(".")[0]);
|
||||
// console.log("object", o);
|
||||
// console.log("result", thinout(path, o));
|
||||
// return o[path.split(".")[0]] = thinout(path, o)
|
||||
// })
|
||||
// console.log("Object", o);
|
||||
// return o;
|
||||
// });
|
||||
// } else {
|
||||
// return res.rows.map( r =>
|
||||
// Object.fromEntries(Object.entries(r).filter(entry => project.includes(entry[0])))
|
||||
// );
|
||||
// }
|
||||
} else {
|
||||
return res.rows;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user