Warning
@@ -116,12 +119,12 @@
Student Answer: {{o
@@ -135,14 +138,14 @@ Student Answer: {{o
-
{{display_name}}
-
+
{{display_name}}
+
({{weight}} point possible)
({{weight}} points possible)
-
QUESTION
+
Question
@@ -152,24 +155,25 @@
{{display_name}}
-
- Answer
-
-
Reflection
-
-
Results
-
-
-
-
-
+
+
+
+
Answer
, Completed
+
+
Reflection, Completed
+
+
Results, In Progress
+
+
+
+
+
-
Correct Answer
-
-
INSTRUCTOR'S EXPLANATION
+
Correct Answer
+
+
Instructor's Explanation
@@ -214,9 +218,9 @@
- Class Breakdown
+ Class Breakdown
This is a look at how your classmates answered the question during the initial and final rounds.
-
Answer Options
+
Answer Options
@@ -224,7 +228,9 @@
Answer Options
Option {{$index + 1}} (correct)
{{option.text}}
+
{{rc.calc($index)}}
{{option.text}}
+
{{rc.calc($index)}}
@@ -232,15 +238,22 @@
Answer Options
-
Initial Answer Selection
-
-
+
+
+
Option {{$index + 1}}: {{rc.calc($index)}} (correct)
+
+
+
Initial Answer Selection
+
+
-
Final Answer Selection
-
-
+
Final Answer Selection
+
diff --git a/ubcpi/static/js/spec/ubcpi_spec.js b/ubcpi/static/js/spec/ubcpi_spec.js
index c986a46..cf368ae 100644
--- a/ubcpi/static/js/spec/ubcpi_spec.js
+++ b/ubcpi/static/js/spec/ubcpi_spec.js
@@ -243,7 +243,7 @@ describe('UBCPI module', function () {
controller.answer_revised = 0;
controller.rationale_revised = 'This is my revised rationale';
expect(controller.status()).toBe(controller.ALL_STATUS.REVISED);
- })
+ });
});
describe('clickSubmit', function() {
@@ -400,6 +400,7 @@ describe('UBCPI module', function () {
});
controller.getStats();
expect(controller.stats).toEqual(response);
+ expect(controller.calc(0)).toBe(" Initial Answer Selection: 100% Final Answer Selection: 0%");
});
it('should call notify with error when backend errors', function() {
@@ -416,8 +417,7 @@ describe('UBCPI module', function () {
'message': 'Please refresh the page and try again!'
});
});
-
- })
+ });
})
});
diff --git a/ubcpi/static/js/src/ubcpi.js b/ubcpi/static/js/src/ubcpi.js
index 44befe8..0eb5f82 100644
--- a/ubcpi/static/js/src/ubcpi.js
+++ b/ubcpi/static/js/src/ubcpi.js
@@ -176,6 +176,34 @@ angular.module('UBCPI', ['ngSanitize', 'ngCookies'])
});
};
+ self.calc = function(s) {
+ var originalPercentage = " Initial Answer Selection: ";
+ var revisedPercentage = " Final Answer Selection: ";
+ if (typeof self.stats.original[s] !== 'undefined') {
+ var totalCounts = 0;
+ for (var i = 0; i < data.options.length; i++) {
+ if (typeof self.stats.original[i] !== 'undefined')
+ totalCounts += self.stats.original[i];
+ }
+ originalPercentage += self.stats.original[s] / totalCounts * 100 + "%";
+ }
+ else
+ originalPercentage += "0%";
+
+ if (typeof self.stats.revised[s] !== 'undefined') {
+ var totalCounts = 0;
+ for (var i = 0; i < data.options.length; i++) {
+ if (typeof self.stats.revised[i] !== 'undefined')
+ totalCounts += self.stats.revised[i];
+ }
+ revisedPercentage += self.stats.revised[s] / totalCounts * 100 + "%";
+ }
+ else
+ revisedPercentage += "0%";
+
+ return originalPercentage + " " + revisedPercentage;
+ };
+
function get_data() {
return backendService.get_data().then(function(data) {
return data;
diff --git a/ubcpi/ubcpi.py b/ubcpi/ubcpi.py
index 3bb65e9..986b143 100644
--- a/ubcpi/ubcpi.py
+++ b/ubcpi/ubcpi.py
@@ -62,8 +62,11 @@ def validate_options(options):
if not any(error in ['Minimum Characters', 'Maximum Characters'] for error in errors) \
and int(options['rationale_size']['max']) <= int(options['rationale_size']['min']):
errors += ['Minimum Characters', 'Maximum Characters']
- if options['algo']['num_responses'] != '#' and int(options['algo']['num_responses']) < 0:
- errors.append('Number of Responses')
+ try:
+ if options['algo']['num_responses'] != '#' and int(options['algo']['num_responses']) < 0:
+ errors.append('Number of Responses')
+ except ValueError:
+ errors.append('Not an Integer')
if not errors:
return None