Skip to content

Bug: Course Blocks API 500s for an enrolled learner when the course start date is in the future #39115

Description

@bmtcril

GET /api/courses/v1/blocks/?course_id=<key>&username=<learner>&depth=all
answers HTTP 500 with the LMS error page when the learner is enrolled in a
course whose start date has not passed. The log shows KeyError: 'self_paced'
then AttributeError: Field self_paced does not exist, raised from the
course-blocks transformers reading the course block's fields.

Every neighbouring learner endpoint handles the same state cleanly:

  • course_home/course_metadata returns
    course_access: {has_access: false, error_code: "course_not_started"}
  • course_home/v1/outline and /navigation answer
    403 {"detail": "Course has not started"}
  • courseware/sequence/<id> answers 404
  • the same Blocks API call as global staff answers 200

Moving the course start into the past makes the learner's call answer 200.

Expected: answer the not-started case the way the course-home APIs do, with
a 403 carrying the access error, rather than reaching the transformers with a
course whose fields were never collected.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugReport of or fix for something that isn't working as intendedhelp wantedReady to be picked up by anyone in the community

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions