Skip to content
Open
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,6 @@ bulk-storage
/.coverage
/coverage.xml
/.vscode/

__pycache__
local_settings.py
8 changes: 5 additions & 3 deletions course/analytics.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,9 +287,11 @@ def __init__(self, group_id, page_id, title, average_correctness,
self.group_id = group_id
self.page_id = page_id
self.title = title
self.average_correctness_percent = 99.99*average_correctness
self.average_emptiness_percent = 99.99*average_emptiness
self.average_wrongness_percent = 99.99*(

self.pct = 100.0
self.average_correctness_percent = self.pct*average_correctness
self.average_emptiness_percent = self.pct*average_emptiness
self.average_wrongness_percent = self.pct*(
1-average_correctness-average_emptiness)
self.answer_count = answer_count
self.total_count = total_count
Expand Down
29 changes: 15 additions & 14 deletions course/flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -703,9 +703,7 @@ def __init__(
self.optional_incorrect_count = optional_incorrect_count
self.optional_unknown_count = optional_unknown_count

# Rounding to larger than 100% will break the percent bars on the
# flow results page.
FULL_PERCENT = 99.99
FULL_PERCENT = 100.0

# {{{ point percentages

Expand Down Expand Up @@ -736,11 +734,10 @@ def unreachable_points_percent(self):
return 0
else:
return self.FULL_PERCENT*(
self.max_points - self.max_reachable_points)/self.max_points
self.max_points - self.max_reachable_points)/self.max_points

def total_points_percent(self):
return (
self.points_percent()
return (self.points_percent()
+ self.missed_points_percent()
+ self.unreachable_points_percent())

Expand Down Expand Up @@ -778,23 +775,27 @@ def optional_total_count(self):

def optional_fully_correct_percent(self):
"""Only to be used for visualization purposes."""
return self.FULL_PERCENT * self.optional_fully_correct_count\
/ self.optional_total_count()
return (self.FULL_PERCENT
* self.optional_fully_correct_count
/ self.optional_total_count())

def optional_partially_correct_percent(self):
"""Only to be used for visualization purposes."""
return self.FULL_PERCENT * self.optional_partially_correct_count\
/ self.optional_total_count()
return (self.FULL_PERCENT
* self.optional_partially_correct_count
/ self.optional_total_count())

def optional_incorrect_percent(self):
"""Only to be used for visualization purposes."""
return self.FULL_PERCENT * self.optional_incorrect_count\
/ self.optional_total_count()
return (self.FULL_PERCENT
* self.optional_incorrect_count
/ self.optional_total_count())

def optional_unknown_percent(self):
"""Only to be used for visualization purposes."""
return self.FULL_PERCENT * self.optional_unknown_count\
/ self.optional_total_count()
return (self.FULL_PERCENT
* self.optional_unknown_count
/ self.optional_total_count())

# }}}

Expand Down
46 changes: 34 additions & 12 deletions course/templates/course/flow-completion-grade.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% extends "course/course-base.html" %}

{% load mathfilters %}
{% load i18n %}

{% block title %}
Expand Down Expand Up @@ -42,12 +42,18 @@ <h1>{% trans "Results" %}: {{flow_desc.title}}</h1>
{% if grade_info.total_points_percent < 100.001 %}
{# otherwise we'll have trouble drawing the bar #}
<div class="progress">
{% with points_percent=grade_info.points_percent|mul:0.9999 %}

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a template {# ... #} comment on why that's here.

{% with missed_points_percent=grade_info.missed_points_percent|mul:0.9999 %}
{% with unreachable_points_percent=grade_info.unreachable_points_percent|mul:0.9999 %}
<div class="progress-bar progress-bar-success"
style="width: {{ grade_info.points_percent|stringformat:".8f" }}%"></div>
style="width: {{ points_percent|stringformat:".6f" }}%"></div>
<div class="progress-bar progress-bar-danger"
style="width: {{ grade_info.missed_points_percent|stringformat:".8f" }}%"></div>
style="width: {{ missed_points_percent|stringformat:".6f" }}%"></div>
<div class="progress-bar progress-bar-info"
style="width: {{ grade_info.unreachable_points_percent|stringformat:".8f" }}%"></div>
style="width: {{ unreachable_points_percent|stringformat:".6f" }}%"></div>
{% endwith %}
{% endwith %}
{% endwith %}
</div>
{% endif %}
<p>
Expand All @@ -64,14 +70,22 @@ <h1>{% trans "Results" %}: {{flow_desc.title}}</h1>
{% endif %}
</p>
<div class="progress">
{% with fully_correct_percent=grade_info.fully_correct_percent|mul:0.9999 %}

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a template {# ... #} comment on why that's here.

{% with partially_correct_percent=grade_info.partially_correct_percent|mul:0.9999 %}
{% with incorrect_percent=grade_info.incorrect_percent|mul:0.9999 %}
{% with unknown_percent=grade_info.unknown_percent|mul:0.9999 %}
<div class="progress-bar progress-bar-success"
style="width: {{ grade_info.fully_correct_percent|stringformat:".8f" }}%"></div>
style="width: {{ fully_correct_percent|stringformat:".6f" }}%"></div>
<div class="progress-bar progress-bar-warning"
style="width: {{ grade_info.partially_correct_percent|stringformat:".8f" }}%"></div>
style="width: {{ partially_correct_percent|stringformat:".6f" }}%"></div>
<div class="progress-bar progress-bar-danger"
style="width: {{ grade_info.incorrect_percent|stringformat:".8f" }}%"></div>
style="width: {{ incorrect_percent|stringformat:".6f" }}%"></div>
<div class="progress-bar progress-bar-info"
style="width: {{ grade_info.unknown_percent|stringformat:".8f" }}%"></div>
style="width: {{ unknown_percent|stringformat:".6f" }}%"></div>
{% endwith %}
{% endwith %}
{% endwith %}
{% endwith %}
</div>
{% endif %}
{% if grade_info.optional_total_count %}
Expand All @@ -89,14 +103,22 @@ <h1>{% trans "Results" %}: {{flow_desc.title}}</h1>
{% endif %}
</p>
<div class="progress">
{% with optional_fully_correct_percent=grade_info.optional_fully_correct_percent|mul:0.9999 %}

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a template {# ... #} comment on why that's here.

{% with optional_partially_correct_percent=grade_info.optional_partially_correct_percent|mul:0.9999 %}
{% with optional_incorrect_percent=grade_info.optional_incorrect_percent|mul:0.9999 %}
{% with optional_unknown_percent=grade_info.optional_unknown_percent|mul:0.9999 %}
<div class="progress-bar progress-bar-success"
style="width: {{ grade_info.optional_fully_correct_percent|stringformat:".8f" }}%"></div>
style="width: {{ optional_fully_correct_percent|stringformat:".6f" }}%"></div>
<div class="progress-bar progress-bar-warning"
style="width: {{ grade_info.optional_partially_correct_percent|stringformat:".8f" }}%"></div>
style="width: {{ optional_partially_correct_percent|stringformat:".6f" }}%"></div>
<div class="progress-bar progress-bar-danger"
style="width: {{ grade_info.optional_incorrect_percent|stringformat:".8f" }}%"></div>
style="width: {{ optional_incorrect_percent|stringformat:".6f" }}%"></div>
<div class="progress-bar progress-bar-info"
style="width: {{ grade_info.optional_unknown_percent|stringformat:".8f" }}%"></div>
style="width: {{ optional_unknown_percent|stringformat:".6f" }}%"></div>
{% endwith %}
{% endwith %}
{% endwith %}
{% endwith %}
</div>
{% endif %}
</div>
Expand Down
Loading