Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Commit

Permalink
Merge pull request #240 from edx/dsjen/answer-dist-copy
Browse files Browse the repository at this point in the history
Updated copy for answer distribution pages.
  • Loading branch information
dsjen committed Jan 30, 2015
2 parents aefe656 + be3b0a7 commit 21a2ce9
Show file tree
Hide file tree
Showing 10 changed files with 63 additions and 46 deletions.
2 changes: 1 addition & 1 deletion acceptance_tests/pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def __init__(self, browser, course_id=None, problem_id=None, part_id=None):

def is_browser_on_page(self):
return super(CoursePerformanceAnswerDistributionPage, self).is_browser_on_page() and \
'Performance Answer Distribution' in self.browser.title
'Performance: Problem Submissions' in self.browser.title


class CourseIndexPage(DashboardPage):
Expand Down
6 changes: 2 additions & 4 deletions acceptance_tests/test_course_performance.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def setUp(self):
def _get_data_update_message(self):
current_data = self.answer_distribution[0]
last_updated = datetime.datetime.strptime(current_data['created'], self.api_datetime_format)
return 'Answer distribution data was last updated %(update_date)s at %(update_time)s UTC.' % \
return 'Problem submission data was last updated %(update_date)s at %(update_time)s UTC.' % \
self.format_last_updated_date_and_time(last_updated)

def test_page(self):
Expand Down Expand Up @@ -57,9 +57,7 @@ def _test_chart(self):

container_selector = '.analytics-chart-container'
element = self.page.q(css=container_selector + ' i')
expected_tooltip = 'This graph shows answers submitted by at least one student, ' \
'and the number of students who submitted each answer. The most frequently submitted answers, ' \
'up to 12, are included.'
expected_tooltip = 'This chart shows the most common answers submitted by students, ordered by frequency.'
self.assertEqual(element[0].get_attribute('data-original-title'), expected_tooltip)

def _test_table(self):
Expand Down
20 changes: 12 additions & 8 deletions analytics_dashboard/courses/presenters/performance.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,7 @@ def get_answer_distribution(self, problem_id, problem_part_id):
def _build_problem_description(self, problem_part_id, questions):
""" Returns the displayable problem name. """
problem = [q for q in questions if q['part_id'] == problem_part_id][0]
if problem['problem_name']:
return u'{0} - {1}'.format(problem['problem_name'], problem['question'])
return problem['question']
return problem['short_description']

def _get_answer_type(self, answer_distributions):
"""
Expand Down Expand Up @@ -119,18 +117,24 @@ def _build_questions(self, answer_distributions):
for i, question in enumerate(questions):
text = question['question']
question_num = i + 1
template = _('Submissions')
question_template = _('Submissions')
short_description_template = ''
if text:
if has_parts:
template = _('Submissions for Part {part_number}: {part_description}')
question_template = _('Submissions for Part {part_number}: {part_description}')
short_description_template = _('Part {part_number}: {part_description}')
else:
template = _('Submissions: {part_description}')
question_template = _('Submissions: {part_description}')
short_description_template = _('{part_description}')
else:
if has_parts:
template = _('Submissions for Part {part_number}')
question_template = _('Submissions for Part {part_number}')
short_description_template = _('Part {part_number}')

# pylint: disable=no-member
question['question'] = template.format(part_number=question_num, part_description=text)
question['question'] = question_template.format(part_number=question_num, part_description=text)
question['short_description'] = short_description_template.format(
part_number=question_num, part_description=text)

return questions

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,22 @@
<span class="section-heading-note small">{% trans "How did students answer this problem?" %}</span>
</div>

{% if problem_part_description %}
<div class="col-xs-12 problem-description">
<div class="col-xs-12 problem-description">

<div class="col-sm-10 col-xs-12">
<p>{{problem_part_description}}</p>
</div>
<div class="col-sm-10 col-xs-12">
<p>{{problem_part_description}}</p>
</div>

<div class="col-sm-2 col-xs-12">
{% if view_live_url%}
<a href="{{view_live_url}}" class="btn btn-default pull-right" role="button" target="_blank">
{# Translators: This text will be a direct link to the a specific module/problem. #}
{% trans "View Live" %}
</a>
{% endif %}
</div>
<div class="col-sm-2 col-xs-12">
{% if view_live_url%}
<a href="{{view_live_url}}" class="btn btn-default pull-right" role="button" target="_blank">
{# Translators: This text will be a direct link to the a specific module/problem. #}
{% trans "View Live" %}
</a>
{% endif %}
</div>
<div class="clearfix"></div>
{% endif %}
</div>
<div class="clearfix"></div>

<div class="section-content section-data-graph">
<div class="section-content section-data-viz">
Expand Down Expand Up @@ -70,16 +68,15 @@
{% endif %}
</div>
{% captureas tip_text %}
{# Translators: This text describes a bar chart displayed. chart_maximum_answers is the maximum number of bars and answers shown. #}
{# Translators: This text describes a bar chart displayed. #}
{% blocktrans trimmed %}
This graph shows answers submitted by at least one student, and the number of students who
submitted each answer. The most frequently submitted answers, up to {{chart_maximum_answers}},
are included.
This chart shows the most common answers submitted by students, ordered by frequency.
{% endblocktrans %}
{% endcaptureas %}
{% include "chart_tooltip.html" with tip_text=tip_text track_category="bar"%}

<div id="performance-chart-view" class="analytics-chart {% if not js_data.course.answerDistribution %}message-only-chart{% endif %}">
<div id="performance-chart-view" class="analytics-chart
{% if not js_data.course.answerDistribution or js_data.course.isRandom %}message-only-chart{% endif %}">
{% if js_data.course.isRandom %}
<!-- sets the message on a new row; otherwise, it won't be centered properly. -->
<div class="clearfix"></div>
Expand All @@ -88,8 +85,14 @@
{% captureas read_more_link_start %}
<a href="{% settings_value 'DOCUMENTATION_LOAD_ERROR_URL' %}" target="_blank">{% endcaptureas %}
{% captureas read_more_link_end %}</a>{% endcaptureas %}
{# Translators: Variants refers to versions of a problem/assignment. #}
{% blocktrans trimmed %}
Due to the number of possible variants for randomized problems, charts are not available. {{read_more_link_start}}Read more{{read_more_link_end}}.
{% endblocktrans %}
<br>
{# Translators: Variants refers to versions of a problem/assignment. #}
{% blocktrans trimmed %}
This chart is not available for randomized questions. {{read_more_link_start}}Read more{{read_more_link_end}}.
Review all submission variants below, or click Download CSV to review them offline.
{% endblocktrans %}
</p>
</div>
Expand Down
8 changes: 4 additions & 4 deletions analytics_dashboard/courses/tests/test_presenters.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ def test_multiple_answer_distribution(self, mock_answer_distribution):
'part_id': 'i4x-edX-DemoX_1-problem-5e3c6d6934494d87b3a025676c7517c1_2_1',
'expected': {
'active_question': 'Submissions for Part 1: Is this a text problem?',
'problem_part_description': 'Example problem - Submissions for Part 1: Is this a text problem?',
'problem_part_description': 'Part 1: Is this a text problem?',
'is_random': False,
'answer_type': 'text'
}
Expand All @@ -270,7 +270,7 @@ def test_multiple_answer_distribution(self, mock_answer_distribution):
'part_id': 'i4x-edX-DemoX_1-problem-5e3c6d6934494d87b3a025676c7517c1_3_1',
'expected': {
'active_question': 'Submissions for Part 2: Is this a numeric problem?',
'problem_part_description': 'Example problem - Submissions for Part 2: Is this a numeric problem?',
'problem_part_description': 'Part 2: Is this a numeric problem?',
'is_random': False,
'answer_type': 'numeric'
}
Expand All @@ -279,7 +279,7 @@ def test_multiple_answer_distribution(self, mock_answer_distribution):
'part_id': 'i4x-edX-DemoX_1-problem-5e3c6d6934494d87b3a025676c7517c1_4_1',
'expected': {
'active_question': 'Submissions for Part 3: Is this a randomized problem?',
'problem_part_description': 'Example problem - Submissions for Part 3: Is this a '
'problem_part_description': 'Part 3: Is this a '
'randomized problem?',
'is_random': True,
'answer_type': 'numeric'
Expand All @@ -300,7 +300,7 @@ def test_single_answer_distribution(self, mock_answer_distribution):
'part_id': 'i4x-edX-DemoX_1-problem-5e3c6d6934494d87b3a025676c7517c1_2_1',
'expected': {
'active_question': 'Submissions: Is this a text problem?',
'problem_part_description': 'Example problem - Submissions: Is this a text problem?',
'problem_part_description': 'Is this a text problem?',
'is_random': False,
'answer_type': 'text'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def assertViewIsValid(self, course_id, problem_id, problem_part_id):

self.assertListEqual(context['questions'], rv.questions)
self.assertDictContainsSubset({
'page_title': 'Performance Answer Distribution',
'page_title': 'Performance: Problem Submissions',
'problem_id': problem_id,
'problem_part_id': problem_part_id,
'view_live_url': 'a/url/{}/jump_to/{}'.format(course_id, problem_id),
Expand Down
6 changes: 5 additions & 1 deletion analytics_dashboard/courses/tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -579,16 +579,19 @@ def get_presenter_performance_answer_distribution_multiple_questions():
{
'part_id': 'i4x-edX-DemoX_1-problem-5e3c6d6934494d87b3a025676c7517c1_2_1',
'question': u'Submissions for Part 1: Is this a text problem?',
'short_description': u'Part 1: Is this a text problem?',
'problem_name': 'Example problem'
},
{
'part_id': 'i4x-edX-DemoX_1-problem-5e3c6d6934494d87b3a025676c7517c1_3_1',
'question': u'Submissions for Part 2: Is this a numeric problem?',
'short_description': u'Part 2: Is this a numeric problem?',
'problem_name': 'Example problem'
},
{
'part_id': 'i4x-edX-DemoX_1-problem-5e3c6d6934494d87b3a025676c7517c1_4_1',
'question': u'Submissions for Part 3: Is this a randomized problem?',
'short_description': u'Part 3: Is this a randomized problem?',
'problem_name': 'Example problem'
}
]
Expand All @@ -599,6 +602,7 @@ def get_presenter_performance_answer_distribution_single_question():
{
'part_id': 'i4x-edX-DemoX_1-problem-5e3c6d6934494d87b3a025676c7517c1_2_1',
'question': u'Submissions: Is this a text problem?',
'short_description': u'Is this a text problem?',
'problem_name': 'Example problem'
}
]
Expand All @@ -620,7 +624,7 @@ def get_presenter_answer_distribution(course_id, problem_part_id):
answer_type = 'numeric'
except ValueError:
answer_type = 'text'
problem_part_description = 'Example problem - Submissions for Part 1: Is this a text problem?'
problem_part_description = 'Submissions for Part 1: Is this a text problem?'

return AnswerDistributionEntry(CREATED_DATETIME, questions, active_question, answer_distributions,
answer_distribution_limited, is_random, answer_type, problem_part_description)
Expand Down
5 changes: 2 additions & 3 deletions analytics_dashboard/courses/views/performance.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@

class PerformanceTemplateView(CourseTemplateWithNavView):
# Translators: Do not translate UTC.
update_message = _('Answer distribution data was last updated %(update_date)s at %(update_time)s UTC.')
update_message = _('Problem submission data was last updated %(update_date)s at %(update_time)s UTC.')


class PerformanceAnswerDistributionView(PerformanceTemplateView):
template_name = 'courses/performance_answer_distribution.html'
page_title = _('Performance Answer Distribution')
page_title = _('Performance: Problem Submissions')
page_name = 'performance_answer_distribution'

def get_context_data(self, **kwargs):
Expand Down Expand Up @@ -50,7 +50,6 @@ def get_context_data(self, **kwargs):

context.update({
'course_id': self.course_id,
'chart_maximum_answers': CoursePerformancePresenter.CHART_LIMIT,
'questions': answer_distribution_entry.questions,
'active_question': answer_distribution_entry.active_question,
'problem_id': problem_id,
Expand Down
13 changes: 11 additions & 2 deletions analytics_dashboard/static/sass/_developer.scss
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ button.chart-info {

// shorten the chart so just a message (e.g. error message) is displayed
.message-only-chart {
height: 38px;
height: inherit; // allows container height to adjust for long messages
min-height: 38px;
}

.nvd3 {
Expand Down Expand Up @@ -81,10 +82,18 @@ button.chart-info {
transform: translateY(-50%);
}

.chart-message-container {
.loading-container {
@extend %vertical-align;
}

.chart-message-container {
top: $padding-large-horizontal * 2;

p {
padding-bottom: $padding-large-horizontal;
}
}

.error-section-container {
padding: $padding-large-horizontal $padding-large-vertical;
padding-bottom: $padding-large-horizontal * 2;
Expand Down
2 changes: 1 addition & 1 deletion analytics_dashboard/templates/loading.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
Partial: Displays a loading spinner
{% endcomment %}
<div class="clearfix"></div>
<div class="chart-message-container">
<div class="loading-container">
<p class="text-center"><i class="fa fa-spinner fa-spin fa-lg" aria-hidden="true"></i> {% trans "Loading" %}</p>
</div>

0 comments on commit 21a2ce9

Please sign in to comment.