Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

EDUCATOR-464: Add POST method to course_summaries/ #173

Merged
merged 1 commit into from
Jun 16, 2017

Conversation

kdmccormick
Copy link
Contributor

@kdmccormick kdmccormick commented Jun 12, 2017

The course_summaries/ currently supports only the GET method. A client can restrict the number of course summaries returned from the endpoint by passing in a list of desired course IDs in the course_ids parameter. However, this is not practically usable, as the number of IDs many clients would want to pass in would make the URL too long. So, Insights currently does not use the course_ids parameter, and instead fetches every course summary and filters them on the client side. Fetching every summary incurs a response time of ~5s.

To fix this, this PR adds a POST method to this endpoint. The POST method functions exactly the same as the GET method, except that all parameters are passed in the request body, allowing a much larger number of course IDs to be passed in. (It is understood that this is not the semantic meaning of the POST verb, however, this is not an uncommon workaround to URL length restrictions).

This PR updates the Analytics API Client to use the new POST method, and this PR updates Insights to take advantage of the course ID filtering now usable in the client.

JIRA Ticket: EDUCATOR-464.

TODO:

  • Write tests
  • Get tests to pass
  • Get thumbs

@edx/educator-dahlia

@efischer19
Copy link
Contributor

The failure you're currently seeing will go away with a git pull; git rebase origin/master to pick up the changes in https://github.com/edx/edx-analytics-data-api/pull/171

@kdmccormick kdmccormick force-pushed the edx/kdmccormick/post-course-summaries branch from 4795f8d to 289ea1f Compare June 13, 2017 20:55
@codecov-io
Copy link

codecov-io commented Jun 13, 2017

Codecov Report

Merging #173 into master will increase coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #173      +/-   ##
==========================================
+ Coverage   97.89%   97.91%   +0.01%     
==========================================
  Files          54       54              
  Lines        3134     3164      +30     
  Branches      235      238       +3     
==========================================
+ Hits         3068     3098      +30     
  Misses         42       42              
  Partials       24       24
Impacted Files Coverage Δ
...s_data_api/v0/tests/views/test_course_summaries.py 100% <100%> (ø) ⬆️
analytics_data_api/v0/views/__init__.py 98.05% <100%> (+0.16%) ⬆️
analytics_data_api/v0/views/course_summaries.py 100% <100%> (ø) ⬆️
analyticsdataserver/tests.py 97.41% <100%> (+0.06%) ⬆️
analytics_data_api/v0/tests/views/__init__.py 99.13% <100%> (+0.09%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5061f38...ff9fb9b. Read the comment docs.

@kdmccormick kdmccormick changed the title WIP: EDUCATOR-464: Add POST method to CourseSummariesView EDUCATOR-464: Add POST method to course_summaries/ Jun 14, 2017
@kdmccormick kdmccormick force-pushed the edx/kdmccormick/post-course-summaries branch from 3e557bb to 387ddd6 Compare June 15, 2017 17:24
@kdmccormick kdmccormick changed the title EDUCATOR-464: Add POST method to course_summaries/ WIP: EDUCATOR-464: Add POST method to course_summaries/ Jun 15, 2017
@kdmccormick kdmccormick force-pushed the edx/kdmccormick/post-course-summaries branch 2 times, most recently from 1f47461 to be1ec92 Compare June 15, 2017 18:23
@kdmccormick kdmccormick changed the title WIP: EDUCATOR-464: Add POST method to course_summaries/ EDUCATOR-464: Add POST method to course_summaries/ Jun 15, 2017
return '/api/v0/{}/{}'.format(self.list_name, query_string)

def validated_request(self, ids=None, fields=None, exclude=None, **extra_args):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the function I'm most interested in feedback on. I'm making it so every request is done as both a GET and POST, and the results are compared before returning. Let me know what you think @efischer19.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it, very nice test addition

POST method allows large number of course ID arguments to be passed as
data, while GET method is restricted by URL length.

EDUCATOR-464
@kdmccormick kdmccormick force-pushed the edx/kdmccormick/post-course-summaries branch from be1ec92 to ff9fb9b Compare June 15, 2017 19:37
Copy link
Contributor

@efischer19 efischer19 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This all makes sense to me, let's keep things moving!

return '/api/v0/{}/{}'.format(self.list_name, query_string)

def validated_request(self, ids=None, fields=None, exclude=None, **extra_args):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it, very nice test addition

Copy link
Contributor

@dsjen dsjen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks for adding documentation; it's very helpful down the road.

It's probably a good time to cut a new release actually and build a new docker image.

@@ -9,3 +9,4 @@ Jason Bau <[email protected]>
John Jarvis <[email protected]>
Dmitry Viskov <[email protected]>
Eric Fischer <[email protected]>
Kyle McCormick <[email protected]>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🥇

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants