appsembler / figures

Reporting and data retrieval app for Open edX
MIT License
44 stars 37 forks source link

John/learner metrics multi course filtering #248

Closed johnbaldwin closed 4 years ago

johnbaldwin commented 4 years ago

This PR adds multiple course filtering for the learner-metrics endpoint.

New functions to support filtering

Adds two functions to figures.sites. This is to support multi-course filtering for the learner-metrics endpoint

  1. enrollments_for_course_ids

This retrieves a CourseEnrollment queryset for enrollments that belong to the list of course ids argument

  1. users_enrolled_in_courses

This retrieves a User queryset for users that are enrolled in the courses identified by the course ids argument

Added tests for the new functionality

New learner-metrics query parameter, "course="

The learner-metrics endpoint now filters on one or more courses using 'course=some-course-id` query parameters. To filter on multiple courses, simply do multiple parameters of the same "course" key. Example

?course-my-first-course-id&course=my-second-course-id
codecov-commenter commented 4 years ago

Codecov Report

Merging #248 into master will increase coverage by 0.06%. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #248      +/-   ##
==========================================
+ Coverage   91.79%   91.86%   +0.06%     
==========================================
  Files          41       41              
  Lines        2133     2150      +17     
==========================================
+ Hits         1958     1975      +17     
  Misses        175      175              
Impacted Files Coverage Δ
figures/serializers.py 94.96% <100.00%> (+0.05%) :arrow_up:
figures/sites.py 68.81% <100.00%> (+2.53%) :arrow_up:
figures/views.py 92.85% <100.00%> (+0.13%) :arrow_up:

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 5664a24...f1f82d1. Read the comment docs.