Skip to content

Commit

Permalink
Avoid /api/courses/ overlap with Open edX COURSE_REGEX.
Browse files Browse the repository at this point in the history
/courses/general/course-v1... and /courses/detail/course-v1...
will be matched by Open edX request util and other course id REGEX's
as a course with id of general/course-v1 etc. and result in 500 errors
particulary in some middlewares.
Addresses #361
  • Loading branch information
bryanlandia committed Jun 10, 2021
1 parent d4e7847 commit 4380ee8
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions figures/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,12 @@
base_name='courses-index')

router.register(
r'courses/general',
r'courses-general',
views.GeneralCourseDataViewSet,
base_name='courses-general')

router.register(
r'courses/detail',
r'courses-detail',
views.CourseDetailsViewSet,
base_name='courses-detail')

Expand Down
4 changes: 2 additions & 2 deletions frontend/src/apiConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ const apiConfig = {
edxUserInfoApi: '/api/user/v1/accounts/',
courseEnrollmentsApi: '/figures/api/course-enrollments/',
generalSiteMetrics: '/figures/api/general-site-metrics/',
coursesGeneral: '/figures/api/courses/general/',
coursesDetailed: '/figures/api/courses/detail/',
coursesGeneral: '/figures/api/courses-general/',
coursesDetailed: '/figures/api/courses-detail/',
learnersGeneral: '/figures/api/users/general/',
learnersDetailed: '/figures/api/users/detail/',
reportingCsvReportsApi: '/reporting/api/csv-reports/',
Expand Down
8 changes: 4 additions & 4 deletions old-docs/api-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -278,15 +278,15 @@ To get the set of general site metrics:
To get a list of all courses with general (summary) metrics for each:

```
/figures/api/courses/general/
/figures/api/courses-general/
```

### Course Details

This endpoint provides a combination of course information and learner activity

```
/figures/api/courses/detail/
/figures/api/courses-detail/
```

To get the data for a specific course:
Expand All @@ -298,13 +298,13 @@ To get the data for a specific course:
Example:

```
/figures/api/courses/detail/course-v1:edX+DemoX+Demo_Course/
/figures/api/courses-detail/course-v1:edX+DemoX+Demo_Course/
```

You can also filter on org:

```
/figures/api/courses/detail/?org=edX
/figures/api/courses-detail/?org=edX
```


Expand Down
2 changes: 1 addition & 1 deletion tests/views/test_general_course_data_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class TestGeneralCourseDataViewSet(BaseViewTest):
'''Tests the UserIndexView view class
'''

request_path = 'api/courses/general'
request_path = 'api/courses-general'
view_class = GeneralCourseDataViewSet

@pytest.fixture(autouse=True)
Expand Down

0 comments on commit 4380ee8

Please sign in to comment.