Skip to content

Commit a4df83a

Browse files
arslanashraf7blarghmatey
authored andcommitted
feat: add canvas integration support (#319)
* feat: add canvas integration support (cherry picked from commit fdb818a)
1 parent 1a38252 commit a4df83a

6 files changed

Lines changed: 33 additions & 3 deletions

File tree

lms/djangoapps/instructor/views/api.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2516,6 +2516,9 @@ def _list_instructor_tasks(request, course_id, serialize_data=None):
25162516
else:
25172517
# Specifying for single problem's history
25182518
tasks = task_api.get_instructor_task_history(course_id, module_state_key)
2519+
elif request.GET.get('include_canvas') is not None:
2520+
from ol_openedx_canvas_integration.task_helpers import get_filtered_instructor_tasks # pylint: disable=import-error
2521+
tasks = get_filtered_instructor_tasks(course_id, request.user)
25192522
else:
25202523
# If no problem or student, just get currently running tasks
25212524
tasks = task_api.get_running_instructor_tasks(course_id)

lms/djangoapps/instructor_task/views.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,9 @@ def get_task_completion_info(instructor_task): # lint-amnesty, pylint: disable=
138138

139139
student = None
140140
problem_url = None
141+
entrance_exam_url = None
141142
email_id = None
143+
task_input = None
142144
try:
143145
task_input = json.loads(instructor_task.task_input)
144146
except ValueError:
@@ -192,6 +194,10 @@ def get_task_completion_info(instructor_task): # lint-amnesty, pylint: disable=
192194
else: # num_succeeded < num_attempted
193195
# Translators: {action} is a past-tense verb that is localized separately. {succeeded} and {attempted} are counts. # lint-amnesty, pylint: disable=line-too-long
194196
msg_format = _("Problem {action} for {succeeded} of {attempted} students")
197+
elif task_input and task_input.get('course_key'):
198+
from ol_openedx_canvas_integration.utils import get_task_output_formatted_message # pylint: disable=import-error
199+
msg_format = get_task_output_formatted_message(task_output)
200+
succeeded = True
195201
elif email_id is not None:
196202
# this reports on actions on bulk emails
197203
if num_attempted == 0:

lms/static/js/instructor_dashboard/instructor_dashboard.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,9 @@ such that the value can be defined later than this assignment (file load order).
176176
}, {
177177
constructor: window.InstructorDashboard.sections.ECommerce,
178178
$element: idashContent.find('.' + CSS_IDASH_SECTION + '#e-commerce')
179+
}, {
180+
constructor: window.InstructorDashboard.sections.CanvasIntegration,
181+
$element: idashContent.find('.' + CSS_IDASH_SECTION + '#canvas_integration')
179182
}, {
180183
constructor: window.InstructorDashboard.sections.Membership,
181184
$element: idashContent.find('.' + CSS_IDASH_SECTION + '#membership')

lms/static/js/instructor_dashboard/util.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@
5151
enableColumnReorder: false,
5252
autoHeight: true,
5353
rowHeight: 100,
54-
forceFitColumns: true
54+
forceFitColumns: true,
55+
enableTextSelectionOnCells: true
5556
};
5657
columns = [
5758
{
@@ -492,7 +493,8 @@
492493
enableCellNavigation: true,
493494
enableColumnReorder: false,
494495
rowHeight: 30,
495-
forceFitColumns: true
496+
forceFitColumns: true,
497+
enableTextSelectionOnCells: true
496498
};
497499
columns = [
498500
{
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<p>
2+
<h2><%- title %></h2>
3+
<table class="stat_table"><tr>
4+
<%_.forEach(header, function (h) {%>
5+
<th><%- h %></th>
6+
<%})%>
7+
</tr>
8+
<%_.forEach(data, function (row) {%>
9+
<tr>
10+
<%_.forEach(row, function (value) {%>
11+
<td><%- value %></td>
12+
<%})%>
13+
</tr>
14+
<%})%>
15+
</table>
16+
</p>

lms/templates/instructor/instructor_dashboard_2/instructor_dashboard_2.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191

9292
## Include Underscore templates
9393
<%block name="header_extras">
94-
% for template_name in ["cohorts", "discussions", "enrollment-code-lookup-links", "cohort-editor", "cohort-group-header", "cohort-selector", "cohort-form", "notification", "cohort-state", "divided-discussions-inline", "divided-discussions-course-wide", "cohort-discussions-category", "cohort-discussions-subcategory", "certificate-allowlist", "certificate-allowlist-editor", "certificate-bulk-allowlist", "certificate-invalidation", "membership-list-widget"]:
94+
% for template_name in ["cohorts", "discussions", "enrollment-code-lookup-links", "cohort-editor", "cohort-group-header", "cohort-selector", "cohort-form", "notification", "cohort-state", "divided-discussions-inline", "divided-discussions-course-wide", "cohort-discussions-category", "cohort-discussions-subcategory", "certificate-allowlist", "certificate-allowlist-editor", "certificate-bulk-allowlist", "certificate-invalidation", "membership-list-widget", "html-datatable"]:
9595
<script type="text/template" id="${template_name}-tpl">
9696
<%static:include path="instructor/instructor_dashboard_2/${template_name}.underscore" />
9797
</script>

0 commit comments

Comments
 (0)