From 2856971b45de4dcfc9745df61cd66a721a301fd0 Mon Sep 17 00:00:00 2001 From: Chris Dodge Date: Wed, 23 Jan 2013 16:36:16 -0500 Subject: [PATCH] update templates to include attemps and weight values. Also update capa_module.py to accept empty strings ('') to mean 'default value' --- common/lib/xmodule/xmodule/capa_module.py | 8 +++++--- .../xmodule/templates/problem/circuitschematic.yaml | 2 ++ .../xmodule/xmodule/templates/problem/customgrader.yaml | 2 ++ common/lib/xmodule/xmodule/templates/problem/empty.yaml | 2 ++ .../xmodule/templates/problem/forumularesponse.yaml | 2 ++ .../xmodule/xmodule/templates/problem/imageresponse.yaml | 2 ++ .../xmodule/xmodule/templates/problem/multiplechoice.yaml | 2 ++ .../xmodule/templates/problem/numericalresponse.yaml | 2 ++ .../xmodule/xmodule/templates/problem/optionresponse.yaml | 2 ++ .../xmodule/templates/problem/string_response.yaml | 2 ++ 10 files changed, 23 insertions(+), 3 deletions(-) diff --git a/common/lib/xmodule/xmodule/capa_module.py b/common/lib/xmodule/xmodule/capa_module.py index 2581973f92..e4ab804f49 100644 --- a/common/lib/xmodule/xmodule/capa_module.py +++ b/common/lib/xmodule/xmodule/capa_module.py @@ -116,9 +116,11 @@ class CapaModule(XModule): self.grace_period = None self.close_date = self.display_due_date - self.max_attempts = self.metadata.get('attempts', None) - if self.max_attempts is not None: - self.max_attempts = int(self.max_attempts) + max_attempts = self.metadata.get('attempts', None) + if max_attempts: + self.max_attempts = int(max_attempts) + else: + self.max_attempts = None self.show_answer = self.metadata.get('showanswer', 'closed') diff --git a/common/lib/xmodule/xmodule/templates/problem/circuitschematic.yaml b/common/lib/xmodule/xmodule/templates/problem/circuitschematic.yaml index ced38faba6..f56b17b1b9 100644 --- a/common/lib/xmodule/xmodule/templates/problem/circuitschematic.yaml +++ b/common/lib/xmodule/xmodule/templates/problem/circuitschematic.yaml @@ -3,6 +3,8 @@ metadata: display_name: Circuit Schematic rerandomize: never showanswer: always + weight: "" + attempts: "" data: | Please make a voltage divider that splits the provided voltage evenly. diff --git a/common/lib/xmodule/xmodule/templates/problem/customgrader.yaml b/common/lib/xmodule/xmodule/templates/problem/customgrader.yaml index 1227e93829..6ada6f97f3 100644 --- a/common/lib/xmodule/xmodule/templates/problem/customgrader.yaml +++ b/common/lib/xmodule/xmodule/templates/problem/customgrader.yaml @@ -3,6 +3,8 @@ metadata: display_name: Custom Grader rerandomize: never showanswer: always + weight: "" + attempts: "" data: |

diff --git a/common/lib/xmodule/xmodule/templates/problem/empty.yaml b/common/lib/xmodule/xmodule/templates/problem/empty.yaml index ae5491ff9f..346f49609c 100644 --- a/common/lib/xmodule/xmodule/templates/problem/empty.yaml +++ b/common/lib/xmodule/xmodule/templates/problem/empty.yaml @@ -4,6 +4,8 @@ metadata: rerandomize: never showanswer: always markdown: "" + weight: "" + attempts: "" data: | diff --git a/common/lib/xmodule/xmodule/templates/problem/forumularesponse.yaml b/common/lib/xmodule/xmodule/templates/problem/forumularesponse.yaml index 231530b9f3..5b30a0497d 100644 --- a/common/lib/xmodule/xmodule/templates/problem/forumularesponse.yaml +++ b/common/lib/xmodule/xmodule/templates/problem/forumularesponse.yaml @@ -3,6 +3,8 @@ metadata: display_name: Formula Response rerandomize: never showanswer: always + weight: "" + attempts: "" data: |

diff --git a/common/lib/xmodule/xmodule/templates/problem/imageresponse.yaml b/common/lib/xmodule/xmodule/templates/problem/imageresponse.yaml index 3a941aa939..069c157852 100644 --- a/common/lib/xmodule/xmodule/templates/problem/imageresponse.yaml +++ b/common/lib/xmodule/xmodule/templates/problem/imageresponse.yaml @@ -3,6 +3,8 @@ metadata: display_name: Image Response rerandomize: never showanswer: always + weight: "" + attempts: "" data: |

diff --git a/common/lib/xmodule/xmodule/templates/problem/multiplechoice.yaml b/common/lib/xmodule/xmodule/templates/problem/multiplechoice.yaml index 322757beee..9e61324ae1 100644 --- a/common/lib/xmodule/xmodule/templates/problem/multiplechoice.yaml +++ b/common/lib/xmodule/xmodule/templates/problem/multiplechoice.yaml @@ -3,6 +3,8 @@ metadata: display_name: Multiple Choice rerandomize: never showanswer: always + weight: "" + attempts: "" markdown: "A multiple choice problem presents radio buttons for student input. Students can only select a single option presented. Multiple Choice questions have been the subject of many areas of research due to the early diff --git a/common/lib/xmodule/xmodule/templates/problem/numericalresponse.yaml b/common/lib/xmodule/xmodule/templates/problem/numericalresponse.yaml index bdca1ef789..e0a5776222 100644 --- a/common/lib/xmodule/xmodule/templates/problem/numericalresponse.yaml +++ b/common/lib/xmodule/xmodule/templates/problem/numericalresponse.yaml @@ -3,6 +3,8 @@ metadata: display_name: Numerical Response rerandomize: never showanswer: always + weight: "" + attempts: "" markdown: "A numerical response problem accepts a line of text input from the student, and evaluates the input for correctness based on its diff --git a/common/lib/xmodule/xmodule/templates/problem/optionresponse.yaml b/common/lib/xmodule/xmodule/templates/problem/optionresponse.yaml index d2603ca607..1a42a5a009 100644 --- a/common/lib/xmodule/xmodule/templates/problem/optionresponse.yaml +++ b/common/lib/xmodule/xmodule/templates/problem/optionresponse.yaml @@ -3,6 +3,8 @@ metadata: display_name: Option Response rerandomize: never showanswer: always + weight: "" + attempts: "" markdown: "OptionResponse gives a limited set of options for students to respond with, and presents those options in a format that encourages them to search for a specific answer rather than being immediately presented diff --git a/common/lib/xmodule/xmodule/templates/problem/string_response.yaml b/common/lib/xmodule/xmodule/templates/problem/string_response.yaml index 987ee9a7bf..1761ea8f67 100644 --- a/common/lib/xmodule/xmodule/templates/problem/string_response.yaml +++ b/common/lib/xmodule/xmodule/templates/problem/string_response.yaml @@ -3,6 +3,8 @@ metadata: display_name: String Response rerandomize: never showanswer: always + weight: "" + attempts: "" # Note, the extra newlines are needed to make the yaml parser add blank lines instead of folding markdown: "A string response problem accepts a line of text input from the