From b8c5990374e828bea9de4b057709a07d230da6ab Mon Sep 17 00:00:00 2001
From: alex <alex@alexloehr.net>
Date: Tue, 06 Oct 2026 18:41:48 +0000
Subject: [PATCH] adding  kursLpGet.js

---
 bin/kursLpGet.js |   24 ++++++++++++++++++++++++
 lib/libLp.js     |    4 ----
 2 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/bin/kursLpGet.js b/bin/kursLpGet.js
new file mode 100644
index 0000000..73d0f66
--- /dev/null
+++ b/bin/kursLpGet.js
@@ -0,0 +1,24 @@
+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)
+}
diff --git a/lib/libLp.js b/lib/libLp.js
index 1198dd3..20e1bed 100644
--- a/lib/libLp.js
+++ b/lib/libLp.js
@@ -17,14 +17,11 @@
     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 = {
@@ -32,7 +29,6 @@
         }
         ret.push(newItem)
     }
-    console.log(ret)
     return ret
 }
 

--
Gitblit v1.8.0