fix(admin): import csv fix groups

darta 2022-02-06 19:16:51 +01:00
parent 9f2790d823
commit 304d8e8724
2 changed files with 5 additions and 4 deletions

View File

@ -842,9 +842,10 @@ class Admin:
### Create all groups. Skip / in system groups
total = len(groups)
log.error(groups)
ev = Events("Syncing groups from external to moodle", total=len(groups))
for g in groups:
parts = g.split(".")
parts = g.split("/")
if not len(parts):
log.error(" MOODLE GROUPS: Group " + g + " empty")
continue
@ -934,7 +935,7 @@ class Admin:
ev = Events("Syncing groups from external to nextcloud", total=len(groups))
for g in groups:
parts = g.split(".")
parts = g.split("/")
if not len(parts):
log.error(" NEXTCLOUD GROUPS: Group " + g + " empty")
continue
@ -1516,7 +1517,7 @@ class Admin:
internaluser = [u for u in self.internal["users"] if u["id"] == user_id][0]
cohorts = self.moodle.get_cohorts()
for group in mdelete:
cohort = [c for c in cohorts if c["name"] == group][0]
cohort = [c for c in cohorts if c["name"] == group[0]]
try:
self.moodle.delete_user_in_cohort(
internaluser["moodle_id"], cohort["id"]

View File

@ -32,7 +32,7 @@ from ..lib.dashboard import Dashboard
dashboard = Dashboard()
@app.route("/sysadmin/api/resync")
@app.route("/api/resync")
@login_required
def resync():