Skip to content

Merge before PR to push Juniper upgrade changes - #3

Merged
BbrSofiane merged 72 commits into
Dicey-Tech:masterfrom
appsembler:master
Oct 4, 2020
Merged

BbrSofiane merged 72 commits into
Dicey-Tech:masterfrom
appsembler:master

Conversation

@BbrSofiane

Copy link
Copy Markdown
Member

No description provided.

johnbaldwin and others added 30 commits July 31, 2020 20:26
This is the initial commit so Matej and work on the front end

The endpoint is `/figures/api/learner-metrics/`

* There is a basic viewset just to exercise the code. The test requires
test data to be filled out and tested in the response

* UserFilterSet needs to be updated or an alternate filter set needs to
be used in order to provide more filtering, in particular
 * Show only users who have enrollments
 * Show only users who do not have enrollments
 * Show only users who have completed
 * Show only users who have not completed

* List serializers need to be added to prefetch data to improve API
performance
* test_learner_metrics_viewset needs to be completed
* Updated the CourseEnrollment mock to provide the `is_enrolled` method
Added `figures.log.log_exec_time` as a context manager to output the log
time for a block of code executed within.

The purpose of this is as a convenience to logging execution time. At
this time, it does not handle variables within the block so it only
outputs the label passed in as a parameter
Added guidance in this module
Broken dependencies found after creating new virtualenvs
We found that figures breaks in Ginkgo due to an apparent issue that Django 1.8 does not support datetime `__day__lte` query parameter.

Pending a decision on whether we need to continue to support Ginkgo, we
are disabling these tests in Ginkgo so that Tox will pass.

If we do need to continue Ginkgo support, then we will implement a
compatibility fix. Otherwise, we will remove all Ginkgo support in an
upcoming release
edx-lint 0.5.5 requires pylint 1.7.1. Not sure why this error is
happening now, since we've edx-lint 0.5.5 and pylint 1.9.5 have been
coexisting in Figures for a while
It was previously set to not run by default. Since the monthly task is
part of Figures normal workflow, we want it enabled by default. This can
be overridden by setting the ENV_VARS 'FIGURES' variable
`ENABLE_FIGURES_MONTHLY_METRICS` to False in the lms.env.json file
Reworked function to get the latest sum of cerfificates across courses
for the site. This is done by querying CourseDailyMetrics.

* Added new test module to focus on testing certificate metrics

This is a workaround. It fixes the metric, but is really just a patch. What needs to happen is to rethink this metric, what we want to say and how to efficiently (storage and query performance) manage certificates achived over time.

Especially since we only want to capture data as they change
This is the initial commit so Matej and work on the front end

The endpoint is `/figures/api/learner-metrics/`

* There is a basic viewset just to exercise the code. The test requires
test data to be filled out and tested in the response

* UserFilterSet needs to be updated or an alternate filter set needs to
be used in order to provide more filtering, in particular
 * Show only users who have enrollments
 * Show only users who do not have enrollments
 * Show only users who have completed
 * Show only users who have not completed

* List serializers need to be added to prefetch data to improve API
performance
* test_learner_metrics_viewset needs to be completed
* Updated the CourseEnrollment mock to provide the `is_enrolled` method
Learner metrics endpoint - Prerelease for evaluation
Fix certificates count as proxy for course completions
Figures 0.3.13 version and README update
…ontend

[WIP] Overall Learner metrics view
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

2. 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
dependabot Bot and others added 29 commits September 4, 2020 10:58
* Add more course information into course multiselect dropdown

* Limit the number of decimals in data display

* view styling improvements, don't initially load all courses data

* add message when no search/course entered

* fix handling when a data entry is non existent

* add course id to columns to better identify the course
Enable automatic security scanning on the repo.
Bump Figures version 0.3.15 and README
* Added prefetch_related to the User model in LearnerMetricsViewSet to
query the related "CourseEnrollment" records
* Updated test coverage to include users, courses, and enrollments for
two sites in order to ensure we are retrieving only the data we want and
avoid "site bleed". For this, created an initial generalized fixture in
"tests/conftest.py". This initial fixture contains User, CourseOverview,
CourseEnrollment, Organization, and Site records. If the version of
"organizations" is our fork (supports multi-site) then
OrganizationCourse and UserOrganizationMapping records are also filled

This commit lays the groundwork for additional performance imporovement
to reduce the number of queries needed in the serializers used for
LearnerMetricsViewSet
* Added django-environ to devsite settings.py in order to allow setting
multisite versus standalone mode in the devsite/devsite/.env file
* Updated the requirements files to add `django-environ`
We were doing two queries before. The code now does one query when LCGM
"most_recent_for_learner_course" is called. We may still run into
performance issues because this means we need to do an individual query
per learner and can't get a bunch of learners most recent LCGM records
in a single call without either restructuring or augmenting out data.
One solution to enabling bulk retrieval is to create an augmented course
data table that has a 1:1 to CourseEnrollment that has the most recent
grade data or links to the most recent LCGM record
* Now LearnerMetricsViewSet only lists users who have an enrollment. Users
who have registerd but not enrolled are not listed
* Improved query performance, adding prefetching on users course
enrollments
We have a ListSerializer for the learner metrics serialzier, but it is
not yet used. How this works now is that we do the query optimization in
the view `get_queryset` method. Then the results are processed in the
serializer
Removed the `to_representation` method from
LearnerMetricsListSerializer because we don't need it
There were missing tests. We checked for each learner, but didn't
check for each learner's enrollments. What was happening with the
`prefetch_related` is that it can't filter just the enrollments we want
in the related table (or at least I haven't found a way to do this yet)
so although we filtered on the learners, we weren't able to filter on
the learner enrollments. So now we need to filter the enrollments for
each learner against the course id list.

Now, we don't strictly need to do this. The front end will filter out
unwanted courses. However, when the query params say "I want these
courses", then it is good form to just return those courses. If we run
into performance issues, then we can return all courses to reduce the
query count and come up with an improved solution
The issue is that Django 1.8 does not support relative comparison for
the 'day' field in QuerySets. Example, this does not work:

`SomeModel.objects(my_date_field__day__lte=some_day`

So we need to perform an explicit datetime range when running with
Django 1.8

Since doing the commit as specified for "non-ginkgo" is more readable,
we don't want to throw it away. Instead, when we no longer have to
support Django 1.8 (meaning Ginkgo), we can then remove this check in
MAU

Tests updated to improve date range checking for MAU
Fix code that doesn't work on Ginkgo (Django 1.8). Have to force merge because codecov is getting stuck again
Performance and test improvement for LearnerMetricsViewSet. Codecov appears stuck, so I have to force merge
Add Learners Progress Overview to main menu. Force merge because codecov is getting stuck
@BbrSofiane
BbrSofiane merged commit b3df88f into Dicey-Tech:master Oct 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants