Function: gradeSubmission()
function gradeSubmission(
context,
siteUrl,
activityId,
userId,
__namedParameters
): Promise<{
changed: string;
feedback?: string;
feedbackFiles?: object[];
grade?: string;
gradebookGrade?: string;
workflowState?: | "notmarked"
| "inmarking"
| "readyforreview"
| "inreview"
| "readyforrelease"
| "released";
}>;
Defined in: areas/assignments/grading.ts:166
Grades a participant as the grader does: a grade (simple grading), a rubric's level per criterion
or a marking guide's score per criterion (by their ids, from rubric()), remarks per criterion,
feedback comments (HTML), feedback files (local paths that replace the ones the participant has;
[] removes them), whether to notify, and any other grading field by name. Returns the grade
saved and the gradebook's grade, the total Moodle computes for a rubric or a guide, and the
feedback files after saving when they were given. Throws GradingError when Moodle refuses the
grade, or when files are given to an assignment without feedback files.
Parameters
| Parameter | Type | Description |
|---|---|---|
context | BrowserContext | - |
siteUrl | string | - |
activityId | number | - |
userId | number | - |
__namedParameters | { applyToGroup?: boolean; feedback?: string; feedbackFiles?: string[]; fields?: Record<string, FieldValue>; grade?: string | number; guide?: Record<number, number>; notify?: boolean; remarks?: Record<number, string>; rubric?: Record<number, number>; workflowState?: | "notmarked" | "inmarking" | "readyforreview" | "inreview" | "readyforrelease" | "released"; } | - |
__namedParameters.applyToGroup? | boolean | With group submissions: grade every member of the participant's group alike (Moodle's default), or only them. |
__namedParameters.feedback? | string | - |
__namedParameters.feedbackFiles? | string[] | Local paths (absolute): the participant's feedback files afterwards. |
__namedParameters.fields? | Record<string, FieldValue> | - |
__namedParameters.grade? | string | number | - |
__namedParameters.guide? | Record<number, number> | Criterion id → score. |
__namedParameters.notify? | boolean | - |
__namedParameters.remarks? | Record<number, string> | Criterion id → remark, for a rubric or a guide. |
__namedParameters.rubric? | Record<number, number> | Criterion id → level id. |
__namedParameters.workflowState? | | "notmarked" | "inmarking" | "readyforreview" | "inreview" | "readyforrelease" | "released" | With the marking workflow: the state to leave the submission in ("released" shows the grade). |
Returns
Promise<{
changed: string;
feedback?: string;
feedbackFiles?: object[];
grade?: string;
gradebookGrade?: string;
workflowState?: | "notmarked"
| "inmarking"
| "readyforreview"
| "inreview"
| "readyforrelease"
| "released";
}>