Material information and saving settings
Material information
sdk.material;
// {
// description: { type: 'text', text: '…' } 또는 { type: 'html', html: '…' },
// entries: { learn: 'index.html', instructor: 'instructor.html', edit: 'edit.html' },
// settings: { … }, // 설정 화면이 저장한 값
// completionPolicy: 'on_submit', // 이 페이지 의 학습 완료 설정 (읽기만. 서버가 주지 않으면 null)
// }
entriescontains the entry files of the screens enabled inmetadata.json.settingsis a public value sent to every viewer, including students. Do not put answers, secrets, or learners' personal information in it. The one exception is the grading settingsettings.grading. The server stripsgradingfrom learning page responses (student · tutor · educator), so it is visible only on the edit screen.
Saving from the settings screen
The edit page opens the entries.edit file with an edit-scope token. In that case, material.settings is the material's draft value (the current version's value if there is no draft). Put the save button inside the settings screen and call saveSettings(); the draft's settings is saved, and when saving finishes, material.settings changes to the saved value. Learners receive this value after the draft is applied (saved as a new version) on the edit page.
import { EliceCDKError } from '@eliceio/cdk';
if (sdk.screen === 'edit') {
document.getElementById('save').addEventListener('click', async () => {
try {
await sdk.saveSettings({ difficulty: 'hard', questionCount: 10 });
showMessage('저장했습니다.');
} catch (err) {
showMessage(
err.code === EliceCDKError.code.DraftNotSaved
? '자료를 먼저 저장하세요.'
: '저장하지 못했습니다.'
);
}
});
}
- When saves happen at the same time, the later one wins.
- If the draft is still being processed or its processing failed, it fails with
content_not_ready. - On the settings screen of an unsaved upload (
#edit=1, no token), it fails withdraft_not_saved, because saving there would change the previous version's settings and discard the upload. Save the material first, then reopen the settings screen. - Called outside the settings screen, it fails with
screen_not_supported; if the session has ended, it fails withsession_expired.
The save result is also sent to the edit page as a message. On success, the edit page reloads the material. The content does not need to do anything extra.
{ source: 'eliceio-content-sdk', type: 'settings-saved', materialId, payload: { status: 'saved' } }
{ source: 'eliceio-content-sdk', type: 'settings-saved', materialId, payload: { status: 'failed', code } }
Grading settings (settings.grading)
The settings screen saves the grading method and answers to settings.grading with saveSettings(). Its type is EliceCDKGrading.
settings.grading | Meaning |
|---|---|
{ type: "pattern", answer_key } | answer_key: a single regular expression. 100 points if it matches the whole answer string (trimmed), otherwise 0 |
{ type: "partial_pattern", answer_key, scores } | Partial scores per question. answer_key is an array of regular expressions and scores is an array of points (same length 1–50, each an integer 0–100, sum of 100 or more). The answer is an array of strings, and the score is the sum of the points of the correct questions (up to 100) |
{ type: "rubric", rubric } | rubric: evaluation criteria. AI grades from 0 to 100 |
- Every regular expression is matched against the whole trimmed answer (full match), must be 500 characters or fewer, and must compile.
- The server matches with Python
re. To ignore case, put(?i)at the start (e.g.(?i)파리|paris).
await sdk.saveSettings({
...sdk.material.settings,
grading: { type: 'partial_pattern', answer_key: ['(?i)paris', '4', '광합성'], scores: [34, 33, 33] },
});
Learning completion settings
The learning completion criterion is a setting of the LXP page, not of settings. After uploading the material, the educator chooses it under 'Settings' in the material edit screen, and it persists across versions. The content only reads it via material.completionPolicy and never changes it.
completionPolicy | LXP screen label | Grading |
|---|---|---|
on_access | Complete on view | Not graded. Completed with 100 points when the student first opens it |
on_submit | Complete on submit | Completed with 100 points on submission |
on_graded | Complete after answer check | Graded with settings.grading |
For how grading results are returned, see Answer submission and history.