1 files modified
1 files added
| New file |
| | |
| | | const db = require("../lib/db") |
| | | const yargs = require("yargs") |
| | | |
| | | ///////////////////////////////////////////////////////////////////////// |
| | | |
| | | const argv = yargs |
| | | .usage("$0 <ref_id>", "get kurs learning progress using <ref_id>",) |
| | | .option("raw", { |
| | | describe: "print raw learning progress of the sub-objects", |
| | | type: "boolean", |
| | | default: false, |
| | | }) |
| | | .strict() |
| | | .parse() |
| | | |
| | | run(argv) |
| | | .then(console.log) |
| | | .catch(console.error) |
| | | .finally(process.exit) |
| | | |
| | | async function run({ref_id, raw}) { |
| | | const {obj_id} = await db.getObjIdFromRefId(ref_id) |
| | | return await db.getKursLp(obj_id, raw) |
| | | } |
| | |
| | | const grouped = _.groupBy(data, "usr_id") |
| | | const ret = [] |
| | | for (const items of Object.values(grouped)) { |
| | | // console.log(items) |
| | | if (!items.length) continue |
| | | const unterStatusse = items.map(it => it.status) |
| | | |
| | | const newStatus = auswerten(unterStatusse) |
| | | const status_changed = _.max(items.map(u => u.status_changed)) |
| | | |
| | | console.log({unterStatusse,newStatus,items}) |
| | | |
| | | const {usr_id, login, firstname, lastname,} = items[0] |
| | | const newItem = { |
| | |
| | | } |
| | | ret.push(newItem) |
| | | } |
| | | console.log(ret) |
| | | return ret |
| | | } |
| | | |