-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathcompletion_criteria.py
106 lines (101 loc) · 2.81 KB
/
completion_criteria.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# -*- coding: utf-8 -*-
# Generated by scripts/generate_from_specs.py
from __future__ import unicode_literals
# CompletionCriteria
APPROX_TIME = "approx_time"
DETERMINED_BY_RESOURCE = "determined_by_resource"
MASTERY = "mastery"
PAGES = "pages"
REFERENCE = "reference"
TIME = "time"
choices = (
(APPROX_TIME, "Approx Time"),
(DETERMINED_BY_RESOURCE, "Determined By Resource"),
(MASTERY, "Mastery"),
(PAGES, "Pages"),
(REFERENCE, "Reference"),
(TIME, "Time"),
)
COMPLETIONCRITERIALIST = [
APPROX_TIME,
DETERMINED_BY_RESOURCE,
MASTERY,
PAGES,
REFERENCE,
TIME,
]
SCHEMA = {
"$id": "/schemas/completion_criteria",
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"description": "Schema for completion criteria of content nodes",
"additionalProperties": False,
"definitions": {
"model": {
"type": "string",
"$exportConstants": "completion_criteria",
"enum": [
"time",
"approx_time",
"pages",
"mastery",
"reference",
"determined_by_resource",
],
},
"mastery_criteria": {"$ref": "/schemas/mastery_criteria"},
},
"properties": {
"model": {"$ref": "#/definitions/model"},
"learner_managed": {"type": "boolean"},
"threshold": True,
},
"required": ["model"],
"anyOf": [
{
"properties": {
"model": {
"anyOf": [
{"const": "time"},
{"const": "approx_time"},
{"const": "pages"},
]
},
"threshold": {"type": "number", "exclusiveMinimum": 0},
},
"required": ["threshold"],
},
{
"properties": {
"model": {"const": "pages"},
"threshold": {
"type": "string",
"pattern": "^(100|[1-9][0-9]?)%$",
"description": "A percentage",
"minLength": 2,
"maxLength": 4,
},
},
"required": ["threshold"],
},
{
"properties": {
"model": {"const": "mastery"},
"threshold": {"$ref": "#/definitions/mastery_criteria"},
},
"required": ["threshold"],
},
{
"properties": {
"model": {
"anyOf": [
{"const": "reference"},
{"const": "determined_by_resource"},
]
},
"threshold": {"type": "null"},
},
"required": [],
},
],
}