Skip to content

fix: casting issues with grading policy#38631

Open
nsprenkle wants to merge 2 commits into
openedx:masterfrom
edx:nsprenkle/casting-issues-with-grading-policy
Open

fix: casting issues with grading policy#38631
nsprenkle wants to merge 2 commits into
openedx:masterfrom
edx:nsprenkle/casting-issues-with-grading-policy

Conversation

@nsprenkle
Copy link
Copy Markdown
Contributor

Description

Fixes issues where incorrectly typed grading policies caused breakages on the progress page.

Supporting information

Some courses were running into the error below which was a result of a grading policy using strings instead of numbers for their values.

  File "/edx/app/edxapp/edx-platform/lms/djangoapps/course_home_api/progress/api.py", line 56, in with_placeholders
    scores=[0] * num_total,
           ~~~~^~~~~~~~~~~
TypeError: can't multiply sequence by non-int of type 'str'

This fix is to correctly cast ints and floats represented as either as strings or numerics to the correct data types to fix this issue.

Testing instructions

  1. Import a course with grading policies represented with strings rather than numbers (e.g. `"num_droppable": "2.0")
  2. Load the progress page, verify page returns a 500 server error.
  3. Load new changes.
  4. Reload progress page, verify working.
  5. Unit tests also updated.

Deadline

ASAP - actively causes breakages in some courses.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant