mitodl / edx-platform

The Open edX platform, the software that powers edX!
http://open.edx.org/
GNU Affero General Public License v3.0
6 stars 1 forks source link

Canvas plugin: AttributeError: 'function' object has no attribute 'items' #298

Closed sentry-io[bot] closed 2 years ago

sentry-io[bot] commented 2 years ago

Sentry Issue: OPENEDX-RESIDENTIAL-514

AttributeError: 'function' object has no attribute 'items'
(2 additional frame(s) were not displayed)
...
  File "lms/djangoapps/instructor_task/tasks_helper/runner.py", line 120, in run_main_task
    task_progress = task_fcn(entry_id, course_id, task_input, action_name)
  File "ol_openedx_canvas_integration/task_helpers.py", line 36, in push_edx_grades_to_canvas
    grades_updated, assignments_created = api.push_edx_grades_to_canvas(course=course)
  File "ol_openedx_canvas_integration/api.py", line 206, in push_edx_grades_to_canvas
    subsection_block_user_grades = get_subsection_block_user_grades(course)
  File "ol_openedx_canvas_integration/api.py", line 131, in get_subsection_block_user_grades
    subsection_user_grades = get_subsection_user_grades(course)
  File "ol_openedx_canvas_integration/api.py", line 102, in get_subsection_user_grades
    ) in course_grade.graded_subsections_by_format.items():
pdpinch commented 2 years ago

We hit this issue when course staff attempt to export grades to Canvas. We use the ol_openedx_canvas_integration plugin for this functionality, but I can't tell if the error is in the plugin, or elsewhere.

pdpinch commented 2 years ago

Classes start on Wednesday, so we'd really like to get this fixed before then.

shaidar commented 2 years ago

Is course_grade overloaded and getting confused with the function here?

arslanashraf7 commented 2 years ago

course_grade is still the property, What's causing this is graded_subsections_by_format i suppose which was done here.

pdpinch commented 2 years ago

Any thoughts on why this wasn't caught in testing earlier? I was told we tested the Canvas integration on mitx-qa with nutmeg before we released in June.

I'm wondering if there's a workaround that we can do while in the meantime.

pdpinch commented 2 years ago

FYI, we have a test case for this now, currently failing.

You can go to https://mitx-qa.mitx.mit.edu/courses/course-v1:MITx+mkdtest.1+2022_Fall/instructor#view-canvas_integration and click the "push all MITx grades to canvas" button.

arslanashraf7 commented 2 years ago

Any thoughts on why this wasn't caught in testing earlier? I was told we tested the Canvas integration on mitx-qa with nutmeg before we released in June.

I'm wondering if there's a workaround that we can do while in the meantime.

I'm not sure why it wasn't caught in testing, these changes are 6 months old and we should've been caught. maybe our fork branch wasn't up to date at that moment. I can create a quick PR which I believe should fix it, the problem is testing -- Setting up Canvas integration locally is time taking. Wondering if there is a way to test it on QA.

pdpinch commented 2 years ago

It would be awesome if you can start on the PR. @shaidar what are our options for testing on QA? Is there a CI instance that's wired into Canvas?

shaidar commented 2 years ago

Yeah looks like CI is configured to use Canvas QA

arslanashraf7 commented 2 years ago

@pdpinch @shaidar https://github.com/mitodl/open-edx-plugins/pull/66 is the PR.

pdpinch commented 2 years ago

You’re going to have to remind me the URL for CI, and then we can try to find a course that’s set up to test on there.

Yeah looks like CI is configured to use Canvas QA

arslanashraf7 commented 2 years ago

Please note that i haven't tested https://github.com/mitodl/open-edx-plugins/pull/66 locally since i don't have Canvas set up right now. If we have a CI instance where we can test it we will need to :

1- Generate the package from the PR branch 2 - Install that in the CI instance and test

shaidar commented 2 years ago

Just to speed things up and given that it's a super minor change, I just made the change on the worker CI instance manually so that we can quickly test it out.

pdpinch commented 2 years ago

@arslanashraf7 can this be closed?

arslanashraf7 commented 2 years ago

@pdpinch yes this can be closed based on:

  1. I checked our last two PyPI releases have this fix
  2. I checked the sentry and I don't see this error happen in the last 2 months.

Closing this.