diff --git a/js/CompletionCriteria.js b/js/CompletionCriteria.js new file mode 100644 index 0000000..3191897 --- /dev/null +++ b/js/CompletionCriteria.js @@ -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", +}; diff --git a/le_utils/constants/completion_criteria.py b/le_utils/constants/completion_criteria.py new file mode 100644 index 0000000..9094d3a --- /dev/null +++ b/le_utils/constants/completion_criteria.py @@ -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, +] diff --git a/scripts/generate_from_specs.py b/scripts/generate_from_specs.py index 2b70a09..6a143ad 100644 --- a/scripts/generate_from_specs.py +++ b/scripts/generate_from_specs.py @@ -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 + "#" + "&" @@ -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)] ) diff --git a/spec/constants-completion_criteria.json b/spec/constants-completion_criteria.json new file mode 100644 index 0000000..13080de --- /dev/null +++ b/spec/constants-completion_criteria.json @@ -0,0 +1,7 @@ +[ + "time", + "approx_time", + "pages", + "mastery", + "reference" +]