6 files modified
2 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) |
| | | } |
| New file |
| | |
| | | const db = require("../lib/db") |
| | | const searchLib = require("../lib/search") |
| | | const yargs = require("yargs") |
| | | |
| | | ///////////////////////////////////////////////////////////////////////// |
| | | |
| | | const argv = yargs |
| | | .usage("$0 <search> [offset] [limit]", "search users",) |
| | | .option("ids-only", { |
| | | describe: "only print matching usr_ids", |
| | | type: "boolean", |
| | | default: false, |
| | | }) |
| | | .strict() |
| | | .parse() |
| | | |
| | | run(argv) |
| | | .then(print) |
| | | .catch(console.error) |
| | | .finally(process.exit) |
| | | |
| | | async function run({search, offset, limit, idsOnly}) { |
| | | if (idsOnly) { |
| | | return await searchLib.search(String(search)) |
| | | } |
| | | offset = offset || 0 |
| | | limit = limit || 20 |
| | | return await db.getUsers(offset, limit, String(search)) |
| | | } |
| | | |
| | | function print (res) { |
| | | if (Array.isArray(res)) { |
| | | console.log(res) |
| | | return |
| | | } |
| | | const {total, offset, limit, data} = res |
| | | console.log({data, count: data.length, total, offset, limit}) |
| | | } |
| | |
| | | |
| | | const udfDef = await db.getUdf() |
| | | const udfMap = _.keyBy(udfDef, "field_name") |
| | | // console.dir(udfMap, {depth: null, colors: true, maxArrayLength: null}) |
| | | user.udf = _.mapKeys(user.udf, function (value, key) { |
| | | return udfMap[key].field_id |
| | | }) |
| | |
| | | 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 |
| | | } |
| | | |
| | |
| | | "test-connect": "mocha test/testConnect.js" |
| | | }, |
| | | "dependencies": { |
| | | "@fastify/compress": "^8.0.1", |
| | | "@fastify/static": "^8.2.0", |
| | | "@vueuse/core": "^13.3.0", |
| | | "@vueuse/router": "^13.3.0", |
| | | "chai": "^5.2.0", |
| | | "@fastify/compress": "^9.2.0", |
| | | "@fastify/static": "^10.1.5", |
| | | "@vueuse/core": "^15.0.0", |
| | | "@vueuse/router": "^15.0.0", |
| | | "chai": "^6.3.0", |
| | | "colors": "^1.4.0", |
| | | "dayjs": "^1.11.13", |
| | | "dotenv": "^16.5.0", |
| | | "dayjs": "^1.11.23", |
| | | "dotenv": "^18.0.5", |
| | | "enquirer": "^2.4.1", |
| | | "fastify": "^5.3.3", |
| | | "flexsearch": "^0.8.205", |
| | | "json-2-csv": "^5.5.10", |
| | | "lodash": "^4.17.21", |
| | | "mocha": "^11.6.0", |
| | | "mysql2": "^3.14.1", |
| | | "fastify": "^5.12.5", |
| | | "flexsearch": "^0.8.212", |
| | | "json-2-csv": "^5.6.0", |
| | | "lodash": "^4.18.1", |
| | | "mocha": "^12.0.3", |
| | | "mysql2": "^3.24.5", |
| | | "nconf": "^0.13.0", |
| | | "nodemon": "^3.1.10", |
| | | "nodemon": "^3.1.14", |
| | | "stylus": "^0.64.0", |
| | | "vue": "^3.5.13", |
| | | "vue-router": "^4.5.1", |
| | | "vue": "^3.5.43", |
| | | "vue-router": "^5.3.1", |
| | | "yargs": "^17.7.2" |
| | | }, |
| | | "devDependencies": { |
| | | "@vitejs/plugin-vue": "^5.2.3", |
| | | "vite": "^6.2.4", |
| | | "vite-plugin-vue-devtools": "^7.7.2" |
| | | "@vitejs/plugin-vue": "^6.0.9", |
| | | "vite": "^8.3.3", |
| | | "vite-plugin-vue-devtools": "^8.2.1" |
| | | } |
| | | } |
| | |
| | | |
| | | ///////////////////////////////////////////////////////////////////////// |
| | | |
| | | describe("the function deleteTeilnahme", function () { |
| | | // todo in libIlias.js ist deleteTeilnahmer auskommentiert - deshalb funktioniert dieser Test auch nicht |
| | | describe.skip("the function deleteTeilnahme", function () { |
| | | |
| | | it("should delete the Teilnahme of a user", async function () { |
| | | const ref_id = 150 |
| | |
| | | |
| | | it("should import a new user to ILIAS", async function () { |
| | | const res = await libIlias.importIliasUser(user) |
| | | console.dir(res, {depth: null}) |
| | | // console.dir(res, {depth: null}) |
| | | expect(res).to.have.property("status").and.to.equal("ok") |
| | | expect(res.command).to.equal("importUser") |
| | | expect(res.usr_id).to.be.a("number").above(0) |