From cc6d1a4f7dad6c6931f09b46265ef7a46cd39d10 Mon Sep 17 00:00:00 2001 From: Justin Leong Date: Fri, 24 Feb 2017 13:48:28 -0800 Subject: [PATCH] Make changes based on edX accessibility review Add accessible percentage selected information to graphs options/legend. Change headings to conform to edX standards. Change contrast ratios (headings, progress bar, steps labels). Fix some previously non-unique IDREFS. Use edX "sr" class to make notion of progress accessible. Make chevrons in progress bar children of list items, with aria-hidden as false. Add padding above QUESTION heading. Make PI heading capitalized, with points weighting text on same line. Fix aria-labelledby reference. Make progress bar use an ordered list. Add aria-hidden="true" to icons. Clarify role of progress bar by adding
. Fix caps and accessibility for progress bar Move spans within lis. Tweak wording Make graphs and progress bar accessible Fix caps, ul, and role Handle non-integer values for number of answers Handle non-integer values in Studio for number of answers shown to students. --- ubcpi/static/html/ubcpi.html | 125 ++++++++++++++++------------- ubcpi/static/js/spec/ubcpi_spec.js | 6 +- ubcpi/static/js/src/ubcpi.js | 28 +++++++ ubcpi/ubcpi.py | 7 +- 4 files changed, 105 insertions(+), 61 deletions(-) diff --git a/ubcpi/static/html/ubcpi.html b/ubcpi/static/html/ubcpi.html index 0f303d7..173f4f1 100644 --- a/ubcpi/static/html/ubcpi.html +++ b/ubcpi/static/html/ubcpi.html @@ -4,12 +4,12 @@
-

{{display_name}}

+

{{display_name}}

 ({{weight}} point possible)
 ({{weight}} points possible)
-

QUESTION

+

Question

{{question_text.image_alt}} @@ -19,27 +19,28 @@

{{display_name}}

- - -
    -

  • Answer
  • - -

  • Reflection
  • - -

  • Results
  • -
-
+
+ +
    +

  1. Answer, Completed
  2. + +

  3. Reflection, In Progress
  4. + +

  5. Results, Upcoming
  6. +
+
+
-
+
-

Step 2) READ OTHER STUDENT ANSWERS

+ Step 2) Read Other Students Answers

These are samples of other student answers for this question. Read them and then compare with your answer below.

  • {{options[answer.option].image_alt}} -

    Student Answer: {{options[answer.option].text}}

    +
    Student Answer: {{options[answer.option].text}}
    {{options[answer.option].image_alt}} Student Rationale @@ -50,23 +51,25 @@

    Student Answer: {{o

- - -
    -

  • Answer
  • - -

  • Reflection
  • - -

  • Results
  • -
-
+
+ + +
    +

  1. Answer, In Progress
  2. + +

  3. Reflection, Upcoming
  4. + +

  5. Results, Upcoming
  6. +
+
+
- Step 1) YOUR INITIAL ANSWER You can change this answer later, if you change your mind. - Step 3) YOUR FINAL ANSWER You now have the option to change your initial selection and explanation, if you wish. + Step 1) Your Initial Answer You can change this answer later, if you change your mind. + Step 3) Your Final Answer You now have the option to change your initial selection and explanation, if you wish.
@@ -98,7 +101,7 @@

Student Answer: {{o

-
+

Student Answer: {{o
- +

Original Answer

- +

Revised Answer

@@ -135,14 +138,14 @@

Student Answer: {{o
-

{{display_name}}

-
+

{{display_name}}

+
({{weight}} point possible)
({{weight}} points possible)
-

QUESTION

+

Question

{{question_text.image_alt}} @@ -152,24 +155,25 @@

{{display_name}}

{{question_text.image_alt}}
- -
    -

  • Answer
  • - -

  • Reflection
  • - -

  • Results
  • -
- -
- -
+
+ +
    +

  1. Answer, Completed
  2. + +

  3. Reflection, Completed
  4. + +

  5. Results, In Progress
  6. +
+ +
+
+
-

Correct Answer

-

-

INSTRUCTOR'S EXPLANATION

+
Correct Answer
+
+
Instructor's Explanation
{{options[rc.correct_answer].image_alt}} @@ -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)}} {{option.image_alt}} @@ -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