Autograder
in package
Shared helpers for Tsugi autograder tools (WebGrader, PythonGrader, DBGrader, …).
Beachhead for grader-specific launch/config patterns that do not belong on Settings, LTIX, or Lessons. Grow this carefully as more duplication appears.
Table of Contents
Methods
- loadCustomConfig() : array<string|int, mixed>|null
- Load full assignment/exercise JSON from LTI custom_config, then lessons.
- decodeConfig() : array<string|int, mixed>|null
- Decode a JSON string into an array accepted by $isValid, or null.
Methods
loadCustomConfig()
Load full assignment/exercise JSON from LTI custom_config, then lessons.
public
static loadCustomConfig(callable $isValid) : array<string|int, mixed>|null
Precedence:
- LTI custom parameter "config" (JSON string)
- The course manifest, or $CFG->lessons when the course has none,
for ?inherit=
or ?exercise= , reading custom key "config"
The tool supplies $isValid to decide whether a decoded array is a usable assignment for that tool's schema.
Parameters
- $isValid : callable
-
function(array $decoded): bool
Return values
array<string|int, mixed>|nulldecodeConfig()
Decode a JSON string into an array accepted by $isValid, or null.
private
static decodeConfig(mixed $raw, callable $isValid) : array<string|int, mixed>|null
Parameters
- $raw : mixed
- $isValid : callable