openedx / openedx/openedx-platform
Bug: Course Blocks API 500s for an enrolled learner when the course start date is in the future
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 8.2k
- Forks
- 4.4k
- Avg merge
- 6d 18h
- Merged PRs (30d)
- 42
Description
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_metadatareturns
course_access: {has_access: false, error_code: "course_not_started"}course_home/v1/outlineand/navigationanswer
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the learner request against a course with a future start date, then compare the course-blocks transformers with the neighbouring course-home access handling described in the issue. Done means the Blocks API returns a 403 with the course-not-started access error and no longer reaches the transformers with missing course fields.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100