Skip to main content

ISC Learn — registering students each semester

Twice a year (September, February) the students of the new semester get a Moodle account on ISC Learn and are enrolled in the course of every module they are registered for. The source of truth is the secretariat's workbook OneDrive-HESSO/ISC/Secrétariat ISC/Suivi des étudiant-e-s/Inscription aux modules/Inscription aux modules YYYY-YY.xlsx: one row per student, one column per module code, cells X (registered), R (repeating), AL (auditing), A (acquired), EQ/RA (equivalence), X?/? (undecided).

The scripts live in ISC-HEI/moodle-isc-admin-scripts (same repository as the yearly course archive); its README holds the generic checklist and the traps. This page is the hannibal-specific run. The workbook is never written to; every step can be re-run and reports what is already in place. First run: 2026-09-09, 33 accounts, 371 autumn enrolments (log).

Before

  • The year's courses exist — the yearly archive ran in summer. A module whose course is still in Archives is reported as "sans cours" and skipped.
  • Accounts are auth=shibboleth, username = email; no password is ever set or mailed.

Run

On the Mac (uv installed, clone of the scripts repo):

./students_from_xlsx.py "<workbook>.xlsx" --out-dir out/
ssh -4 -p 20002 ubuntu@learn.isc-vs.ch 'mkdir -p /tmp/isc-enrol && chmod 777 /tmp/isc-enrol'
scp -4 -P 20002 out/*.csv script_check_users.php script_enrol_students.php ubuntu@learn.isc-vs.ch:/tmp/isc-enrol/

On hannibal (M=/srv/www/learn.isc-vs.ch/moodle_isc, Moodle 5.x so the CLI tools sit under public/):

cd /tmp/isc-enrol && chmod 644 *.csv
sudo -u www-data MOODLE_ROOT=$M php script_check_users.php /tmp/isc-enrol/students.csv # new / existing / to decide
sudo -u www-data php $M/public/admin/tool/uploaduser/cli/uploaduser.php --file=/tmp/isc-enrol/students_new.csv \
--delimiter_name=comma --uutype=0 --uuforcepasswordchange=0 --uupasswordnew=1 # creates the accounts
sudo -u www-data MOODLE_ROOT=$M php script_enrol_students.php enrolments.csv --dry-run --semester=S1,S3,S5
sudo -u www-data MOODLE_ROOT=$M php script_enrol_students.php enrolments.csv --semester=S1,S3,S5 # autumn; spring is S2,S4,S6

Re-run the dry-run afterwards: it must print À inscrire : 0.

Decisions the scripts leave to a person

  • À arbitrer in the account check: a homonym with another address (the workbook and Moodle disagree on the e-mail — fix one of them), a suspended or deleted account. Nothing in that list is created.
  • Modules sans cours: the maths modules 100.1/100.3/100.4 have no Learn course (Sept 2026); 205.4 neither. Ignore unless a teacher asks for one.
  • Marques incertaines (X?, ?): listed, not enrolled; --include-uncertain takes them once the secretariat has settled them.
  • Bachelor thesis 330.1 sits under S6 in the workbook, so the autumn filter skips it; enrol it by hand or with a spring-style run when it should open.

Traps and the reasoning behind the flags (--uupasswordnew=1 is a no-op for Shibboleth but the form demands it; any forced password change locks Shibboleth users out) are in the repository README. Open items: ops todo → ISC Learn.