Skip to content

Commit

Permalink
Merge pull request #68 from eduNEXT/bav/show-parents-display-name
Browse files Browse the repository at this point in the history
feat: return the display name of the section and subsection of each unit
  • Loading branch information
farhan authored Mar 23, 2024
2 parents d2fd216 + 9104c42 commit 6450d92
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
14 changes: 6 additions & 8 deletions feedback/extensions/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,21 +140,19 @@ def load_blocks(request, course):
except ZeroDivisionError:
average_rating = 0

parent, _ = get_block_by_usage_id(
request,
str(course.id),
str(feedback_block.parent),
disable_staff_debug_info=True,
course=course,
)
unit = block.get_parent()
subsection = unit.get_parent()
section = subsection.get_parent()

blocks.append(
{
"display_name": block.display_name,
"prompts": block.prompts,
"vote_aggregate": vote_aggregate,
"answers": answers[-10:],
"parent": parent.display_name,
"unit_display_name": unit.display_name,
"subsection_display_name": subsection.display_name,
"section_display_name": section.display_name,
"average_rating": average_rating,
"url": get_lms_link_for_item(block.location),
}
Expand Down
4 changes: 2 additions & 2 deletions feedback/static/html/feedback_instructor.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<thead>
<tr role="row">
<th colspan="6" role="columnheader">
<span class="d-flex align-items-center"><span>{% trans "Unit" %}</span></span>
<span class="d-flex align-items-center"><span>{% trans "Component" %}</span></span>
</th>
<th colspan="3" role="columnheader">
<span class="d-flex align-items-center"><span>{% trans "Number of ratings" %}</span></span>
Expand All @@ -24,7 +24,7 @@
{% for block in blocks %}
<tr role="row" class="pgn__data-table-row">
<td colspan="6" role="cell" class="pgn__data-table-cell-wrap">
<a class="admin-panel" href="{{ block.url }}"><button class="btn btn-primary" ="button">{% trans "See Unit" %}: {{ block.parent }}</button></a>
<a class="admin-panel" href="{{ block.url }}"><button class="btn btn-primary" ="button">{{ block.section_display_name }} > {{ block.subsection_display_name }} > {{ block.unit_display_name }} > {{ block.display_name }}</button></a>
</td>
<td colspan="3" role="cell" class="pgn__data-table-cell-wrap">
<ul>
Expand Down

0 comments on commit 6450d92

Please sign in to comment.