Skip to content

Commit

Permalink
Merge pull request #98 from learningequality/completion_criteria
Browse files Browse the repository at this point in the history
Add completion criteria.
  • Loading branch information
rtibbles authored Dec 16, 2021
2 parents e032083 + ba80c27 commit 4005596
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 1 deletion.
11 changes: 11 additions & 0 deletions js/CompletionCriteria.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// -*- coding: utf-8 -*-
// Generated by scripts/generate_from_specs.py
// CompletionCriteria

export default {
approx_time: "approx_time",
mastery: "mastery",
pages: "pages",
reference: "reference",
time: "time",
};
27 changes: 27 additions & 0 deletions le_utils/constants/completion_criteria.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# -*- coding: utf-8 -*-
# Generated by scripts/generate_from_specs.py
from __future__ import unicode_literals

# CompletionCriteria

approx_time = "approx_time"
mastery = "mastery"
pages = "pages"
reference = "reference"
time = "time"

choices = (
(approx_time, "Approx Time"),
(mastery, "Mastery"),
(pages, "Pages"),
(reference, "Reference"),
(time, "Time"),
)

COMPLETIONCRITERIALIST = [
approx_time,
mastery,
pages,
reference,
time,
]
6 changes: 5 additions & 1 deletion scripts/generate_from_specs.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ def pascal_to_snake(name):
return pascal_case_pattern.sub("_", name).lower()


def snake_to_pascal(name):
return "".join(a.title() for a in name.split("_"))


CHARACTERS = string.ascii_letters + string.digits + "#" + "&"


Expand Down Expand Up @@ -145,7 +149,7 @@ def read_constants_specs():
for constants_spec_file in constants_spec_files:
with open(constants_spec_file) as json_constants_spec_file:
constants_spec = json.load(json_constants_spec_file)
key = constants_spec_file.split("-")[-1].split(".")[0].title()
key = snake_to_pascal(constants_spec_file.split("-")[-1].split(".")[0])
constants_outputs[key] = OrderedDict(
[(a, a) for a in sorted(constants_spec)]
)
Expand Down
7 changes: 7 additions & 0 deletions spec/constants-completion_criteria.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[
"time",
"approx_time",
"pages",
"mastery",
"reference"
]

0 comments on commit 4005596

Please sign in to comment.