Commit Graph

147 Commits

Author SHA1 Message Date
Justin Hynes
ef6de11467 feat: Send modified data of a learner's grade to the Credentials IDA
[APER-1968]

We don't have a good way to understand if grade data in Credentials is out of sync with the LMS. Grades are sent to Credentials via a REST API call originating from an asynchronous Celery task on the LMS side. This PR updates our Celery task `send_grade_to_credentials` to include sending the `modified` DateTime value of a grade record to the Credentials IDA. Updates will be made on the Credentials side to accept and store this data as part of the UserGrade instance.

* Updates the `send_grade_to_credentials` task to include passing the grade's `modified` DateTime info as part of the request data to Credentials
* Updates the `CourseGradeBase` class to include an optional `last_updated` field. This will store the `modified` date of a PersistentCourseGrade instance when a grade is read through the CourseGradeFactory.
* Update existing log statement to use format strings where possible.
2022-09-15 08:02:26 -04:00
Sagirov Evgeniy
42adcaaf4d FC-0001: Remove Persistent Course Grades Flags (#30978)
* feat: revert Fix certificate generation without persistent grades

* feat: Remove Persistent Course Grades Flags

* test: update tests
2022-09-14 14:00:01 -04:00
Justin Hynes
9e83bf8f94 feat: Add configuration option to route View Records button to the Learner Record MFE
[APER-1922]

We are converting the legacy UI of the `records` app in the Credentials IDA (credentials.edx.org/records/, credentials.edx.org/records/programs/{uuid}, etc.) to a new MFE. Today, the Program Dashboard and the legacy (non-MFE) profile page have buttons that route learners to the Credentials IDA pages. We need to (optionally) introduce a way to route learner's to the new MFE instead.

- Introduces a new configuration setting called `LEARNER_RECORD_MICROFRONTEND_URL` (defaulting to None). This will be used by the LMS to store the base URL of the new MFE (e.g. records.stage.edx.org).
- Introduces a new waffle switch named `USE_LEARNER_RECORD_MFE`. This will be used to control whether routing learner's to the new MFE is enabled from the LMS's side.
- Updates the existing `get_credentials_records_url` function to add additional logic that will determine if we need to build a link to the legacy FE or the new MFE
- Adds tests for new and existing behavior. There were no existing unit tests for the utility function that I updated.
2022-09-07 13:44:05 -04:00
connorhaugh
45c2858d61 Revert "feat: FC-0001 Remove Persistent Course Grades Flags (#30540)" (#30744)
This reverts commit 4a9243ef9f.
2022-07-19 13:45:31 -04:00
Sagirov Evgeniy
4a9243ef9f feat: FC-0001 Remove Persistent Course Grades Flags (#30540)
* feat: revert Fix certificate generation without persistent grades

* feat: Remove Persistent Course Grades Flags

* test: update tests
2022-07-19 11:30:37 -04:00
Eugene Dyudyunov
b4fecd620b refactor: rename toggle_warnings to toggle_warning (#30458)
Rename toggle_warnings to toggle_warning for consistency with setting_warning.
2022-05-24 11:47:31 -04:00
Eugene Dyudyunov
289e682b8f FC-0001: Remove old EdxRestAPIClient usage across the platform (#30301)
* refactor: remove EdxRestAPIClient

* test: update tests according to EdxRestAPIClient removal

* fix: remove unused import
2022-05-09 12:48:26 -04:00
Jawayria
8ccb8b0608 chore: Applied lint-amnesty on openedx/core/djangoapps 2021-12-09 13:32:06 +05:00
M. Zulqarnain
39b91154fb feat: New codemods on OpenedX 1 (#28776) 2021-10-27 13:07:36 +05:00
M. Zulqarnain
9833134fae Post Django 3.2 Cleanup (#29069)
* chore: Post Django 3.2 Cleanup
2021-10-22 13:55:16 +05:00
Muhammad Soban Javed
2845786a14 Merge pull request #28723 from edx/iamsobanjaved/django-30-db-args
test: fix skip-checks in a test for django 30
2021-09-16 13:47:37 +05:00
Thomas Tracy
6f44841deb [feat] Add user_id scope to credentialsApiClient (#28737)
Now that we're actively using the LMS_USER_ID inside credentials to
identify users, we need to make sure that users created by
notify_credentials are including it in the jwt scopes when authenticated
with credentials.
2021-09-15 09:17:51 -04:00
Soban Javed
78afc41d4c test: fix skip-checks in a test for django 30 2021-09-15 11:01:38 +05:00
oliviaruizknott
dbfe2a3f2b feat: notify_credentials of changed overrides
We use the `notify_credentials` management command to keep certificate-
related data in the LMS and Credentials service in sync. We can run it
with specific arguments (user_ids, course_keys, etc.) when we notice a
data discrepancy; and it is run regularly by a Jenkins job with the
`--auto` flag every ~4 hours to keep things up-to-date.

Because we probably never want to notify credentials of of ALL the
GeneratedCertificates, the celery task must be given some arguments
to filter down to the relevant certificates. Running the management
command with the `--auto` flag (as the Jenkins job does) adds
`start_date` and `end_date` arguments of 4 hours ago and now,
respectively.

The handle_notify_credentials celery task then takes those arguments and
looks for any GeneratedCertificates that have been modified within the
given time range by checking the GeneratedCertificate modified_date.
It will send the current data for those certificates to credentials.

However, we also want to notify credentials about certificates that have
an associated CertificateDateOverride that has changed within that time
range: added, updated, or deleted. But changes to a
CertificateDateOverride won’t affect the GeneratedCertificate’s modified
date, and therefore wouldn’t be included in the list of certs cent to
credentials.

This commit adds a check for changed CertificateDateOverrides and
includes their associated GeneratedCertificates in the list of certs. We
use the CertificateDateOverride’s history model for this check so that
we can include certificates whose override was deleted.

MICROBA-1489
2021-09-10 12:32:17 -06:00
Albert (AJ) St. Aubin
87d3fc3611 feat: Added detail to the log for failed grade sends to credentials
[MICROBA-1282]

To help with future errors sending grades to Credentials I am adding
additional data to the log message.
2021-08-23 08:58:54 -04:00
Awais Qureshi
3d528ad590 chore: Django3 has removed python_2_unicode_compatible.
Execute the codemodes.
2021-07-27 23:25:27 +05:00
Thomas Tracy
2a54a66582 [fix] MB-1391 certificate_available_date cleanup command (#28279)
* [fix] Certificate availability date cleanup

This task will clean out the misconfigured certificate available date. When courses Change their
certificates_display_behavior, the certificate_available_date was not updating properly. This is
command is meant to be ran one time to clean up any courses that were not supposed to have
certificate_available_date
2021-07-27 12:35:46 -04:00
Albert (AJ) St. Aubin
c37e88fdbf refactor: Move CertificateStatuses to data.py file per OEP-49
[MICROBA-678]

To allow access to CertificateStatuses constants in other Django apps we are moving the
CertificateStatuses enum to data.py per OEP-49.
2021-06-08 08:56:21 -04:00
Aarif
58a54f8d0b BOM-2543: Remove the diff-quality step from quality checks (#27619)
* build: Removed the diff-quality step
Applied lint-amnesty on all the warnings
Removed pylint thresholds comparison code and related tests

Co-authored-by: Usama Sadiq <usama.sadiq@arbisoft.com>
2021-06-07 18:37:06 +05:00
Thomas Tracy
4d8abcac00 MB-1067: [refactor] Change credentials date backfill to single longlived task (#27734)
[refactor] change backfill date task to long running task

Change from a task that spins off multiple other tasks to a single long
running task. This will hopefully be way less heavy when this is ran in
production.
2021-05-26 16:31:22 -04:00
Thomas Tracy
089dbf6e20 [refactor] Move backfill_date_for_all_course_runs to Tasks.py (#27725)
* [refactor] Move backfill_date_for_all_course_runs to Tasks.py

In order for celery to register this task, it needs to be in the right
file. duh!

* fix imports

* fix more imports
2021-05-25 16:53:26 -04:00
Thomas Tracy
0b00b40259 MB-1067: Management command to populate credentials availability date (#27650)
* [feat] Management command to populate credentials availability date

This is a command to populate the new CredentialsCertificate model's
available_date for every existing course_run.
2021-05-24 15:30:14 -04:00
Usama Sadiq
4f4be6538a BOM-2477: pylint warnings lint-amnesty (#27585) 2021-05-11 17:22:40 +05:00
Usama Sadiq
13ef0c7762 refactor: pyupgrade second iteration (#27462) 2021-05-11 11:25:22 +05:00
Usama Sadiq
46993bff00 refactor: pyupgrade second iteration (#27461) 2021-05-11 11:24:07 +05:00
Albert (AJ) St. Aubin
65977a9e02 [feat] Added program_uuids to notify_credentials mgmt cmd (#27503)
* [feat] Added program_uuids to notify_credentials mgmt cmd

[MICROBA-951]

To support updating a users credentials in the Credentials services for
all users enrolled in a program we have added a command line argument to
the notify_credentials command called program_uuids. This supports a
list of program uuids. It will retrieve all course runs in the listed
programs and update the related credentials data.

* updated comments
2021-05-05 11:48:11 -04:00
Olivia Ruiz-Knott
d7a4947ea9 Merge pull request #27322 from edx/ork/MICROBA-963_move-notify-credentials-to-celery-task
perf: move notify_credentials to a celery task
2021-04-27 09:47:03 -06:00
Usama Sadiq
588f11b100 refactor: apply lint-amnesty to pylint violations 2021-04-27 14:43:31 +05:00
oliviaruizknott
5fbb339c25 perf: move notify_credentials to a celery task
Before this change, the notify_credentials management command ran for
about 10-15 minutes and occasionally overlapped with an edxapp
deployment which would cause the machine the command was running
on to die. The command ran through a bunch of certs and grades, and then
spun off celery tasks to send the relevant data to credentials.

Now, most of the logic of the notify_credentials management command has
been moved into a new celery task, so that combing through longs lists
of certs and grades is done asynchronously. This task then spins off the
original data-sending tasks as before.

Note that this requires a change in alerting: where the jenkins job
would previously notify us about failures, we need to know when this
new celery task fails for any reason. We’ve made this a LoggedTask
so that failures will be logged to Splunk and alerting can be built off
of the error messages.

This commit also moves the relevant tests.

MICROBA-963
2021-04-26 12:11:25 -06:00
Albert (AJ) St. Aubin
c2db5c8906 [bug] Added in check for MySQL OperationalError for local development
[MICROBA-951]

When running the notify_credentials command locally there is an
OperationalError thrown by MySQL when there are no more results
available for the queryset iterator. This change catches that exception,
checks state, and then logs according to that state. This code runs in
production without issue. This changes allows for the code to be run
locally without a separate code path.
2021-04-12 10:36:49 -04:00
Jawayria
df06d1312d refactor: Removed unused imports
Removed unused imports from openedx/core/djangoapps/{content_libraries, coursegraph,courseware_api, crawlers, credentials, credit}
2021-04-06 17:07:13 +05:00
Thomas Tracy
9f4e51a241 feat: Add command to generate credentials config (#27088)
Adds a command to create an API connection to credentials for testing
program certificates on devstack. This command is not meant to be ran
manually, and will be included in a provisioning type script that will
be added later.
2021-03-29 10:04:59 -04:00
Usama Sadiq
7108562c87 refactor: ran pyupgrade on openedx/core/djangoapps/credentials (#26847) 2021-03-15 18:09:56 +05:00
Kyle McCormick
9aefd6f986 style: django-not-configured is not a sensible lint-amnesty value (#26862)
django-not-configured is an error raised by pylint (with
the pylint-django plugin) when it's not correctly configured.

We should not be applying lint amnesty for such a violation.
2021-03-05 08:11:58 -05:00
Matt Tuchfarber
5345466e31 Merge pull request #26622 from edx/tuchfarber/remove_pii_from_mgmt_cmd_cfg
Update mgmt cmds to use user_ids instead of PII
2021-02-22 11:04:49 -05:00
Matt Tuchfarber
55d9e18495 Update mgmt cmds to use user_ids instead of PII 2021-02-22 10:30:35 -05:00
Aarif
ba16e05899 replaced unittest assertions pytest assertions (#26564) 2021-02-19 16:04:32 +05:00
Olivia Ruiz-Knott
5c95258115 Merge pull request #26461 from edx/ork/MICROBA-989_notify-credentials-takes-usernames
feat: allow notify_credentials to take a list of usernames
2021-02-12 10:45:15 -05:00
oliviaruizknott
52814f7378 test: add test to notify_credentials for multiple usernames 2021-02-10 11:25:23 -05:00
oliviaruizknott
0533ecc814 feat: allow notify_credentials to take a list of usernames 2021-02-09 17:04:21 -05:00
Matt Tuchfarber
64032faae7 Make credentials celery tasks errors consistent
In order to better alert off of tasks that failed after maximum retries,
this makes the the error for each task consistent with itself.
2021-02-08 13:55:35 -05:00
Soban Javed
5199bf7acb Replace task decorator with shared_task in openedx 2021-02-04 18:35:38 +05:00
M. Zulqarnain
355423d322 pylint amnesty in openedx (#26364) 2021-02-04 15:34:01 +05:00
Robert Raposa
874c3e7b61 Merge pull request #25182 from regisb/regisb/disable-learner-records-from-settings
Add default value for learner records feature toggle in settings
2020-12-17 12:16:40 -05:00
Régis Behmo
bd038bab3c Add default value for learner records feature toggle in settings
The learner records feature had to be enabled/disabled via site-specific
configuration models, which is inconvenient for platforms that want to
disable this feature globally. Here, we introduce a
ENABLE_LEARNER_RECORDS feature toggle in the lms/cms settings that makes
it possible to disable this feature on all sites. Because this feature
toggle is set to True by default, this will not modify the behaviour of
existing platforms.
2020-12-17 16:28:04 +01:00
Muhammad Soban Javed
bd601cf3a6 Update celery routing for celery 4+ (#25567)
* Update celery routing

- Used routing function instead of class
- Move task queues dictionary to Django settings
- Removed routing_key parameter
- Refactored routing for singleton celery instantiation

Co-authored-by: Awais Qureshi <awais.qureshi@arbisoft.com>
2020-12-16 13:40:47 +05:00
Robert Raposa
8eef18710d set code_owner for celery tasks
ARCHBOM-1260

Co-authored-by: Tim McCormack <tmccormack@edx.org>
2020-11-17 15:33:33 -05:00
Albert (AJ) St. Aubin
9551b23d08 [MICROBA-721] Updates the notify_credentials job to run over new window 2020-11-12 08:27:03 -05:00
Awais Qureshi
7201edb11d Revert "Update routing config" (#25536)" (#25549)" (#25553)" (#25561)
This reverts commit db4c3b1210.
2020-11-11 00:13:47 +05:00
Awais Qureshi
db4c3b1210 Revert "Revert ""Update routing config" (#25536)" (#25549)" (#25553)
This reverts commit c1fe3c3a93.
2020-11-10 23:23:09 +05:00