1 files added
2 files modified
| | |
| | | } |
| | | }) |
| | | |
| | | // abmelden |
| | | .delete("/api/kurs/:refId/teilnehmer/:usrId", async function (req, res) { |
| | | const {refId, usrId} = req.params |
| | | if (!refId || !usrId) throw {status: "error", msg: "refId and usrId requried"} |
| | |
| | | getSingleKursTeilnehmer, |
| | | getKursTeilnehmerCount, |
| | | |
| | | getKursLp, |
| | | getKursUnterobjektLp, |
| | | |
| | | getKursOffline, |
| | | setKursOffline, |
| | | |
| | |
| | | return results |
| | | } |
| | | |
| | | async function getKursLp(obj_id) { |
| | | |
| | | } |
| | | |
| | | async function getKursUnterobjektLp(obj_id) { |
| | | const pool = await poolP |
| | | const q = `SELECT ulc.obj_id, |
| | | ulc.item_id, |
| | | ulc.lpmode, |
| | | t.obj_id as item_obj_id, |
| | | ulm.usr_id, |
| | | ulm.status, |
| | | ulm.status_changed, |
| | | ulm.percentage, |
| | | ulm.completed |
| | | FROM ${database}.ut_lp_collections ulc |
| | | INNER JOIN ${database}.object_reference t ON t.ref_id = ulc.item_id |
| | | INNER JOIN ${database}.ut_lp_marks ulm ON ulm.obj_id = t.obj_id |
| | | WHERE ulc.obj_id = ${obj_id} # obj_id Kurs |
| | | AND ulc.active = 1 |
| | | AND ulc.lpmode = 5 # nur mode 5 |
| | | ` |
| | | const [results] = await pool.query(q) |
| | | return results |
| | | } |
| | | |
| | | |
| | | async function getKursOffline(obj_id) { |
| | | const pool = await poolP |
| | | const q = `SELECT offline |
| | | FROM ${database}.object_data |
| | | const q = `SELECT offline |
| | | FROM ${database}.object_data |
| | | WHERE obj_id = ${obj_id} |
| | | ` |
| | | const [results] = await pool.query(q) |
| New file |
| | |
| | | const expect = require("chai").expect |
| | | |
| | | const settings = require("../settings") |
| | | const libIlias = require("../lib/libIlias") |
| | | const db = require("../lib/db") |
| | | const testData = require("./data") |
| | | |
| | | ///////////////////////////////////////////////////////////////////////// |
| | | |
| | | describe("regarding the Kurs LP", function () { |
| | | |
| | | const kurs = testData.kurs // TODO real test |
| | | let kursId = 32212 |
| | | |
| | | beforeEach(async function () { |
| | | }) |
| | | |
| | | afterEach(async function () { |
| | | }) |
| | | |
| | | describe("the function getKursUnterobjektLp", function () { |
| | | it("should deliver the LP for the Kurs Unterobjekte", async function () { |
| | | const res = await db.getKursUnterobjektLp(kursId) |
| | | console.table(res) |
| | | expect(res).to.be.a("array") |
| | | for(const item of res) { |
| | | expect(item).to.have.property("obj_id").and.to.be.a("number") |
| | | expect(item).to.have.property("item_id").and.to.be.a("number") |
| | | expect(item).to.have.property("lpmode").and.to.be.a("number") |
| | | expect(item).to.have.property("item_obj_id").and.to.be.a("number") |
| | | expect(item).to.have.property("usr_id").and.to.be.a("number") |
| | | expect(item).to.have.property("status").and.to.be.a("number") |
| | | expect(item).to.have.property("status_changed").and.to.be.a("date") |
| | | } |
| | | }) |
| | | }) |
| | | |
| | | |
| | | |
| | | }) |
| | | |
| | | ///////////////////////////////////////////////////////////////////////// |
| | | |