Commit Graph

310 Commits

Author SHA1 Message Date
edX requirements bot
bb20b17428 Python Requirements Update (#29516)
* chore: Updating Python Requirements

* fix: fix pylint issues

Co-authored-by: Mohammad Ahtasham ul Hassan <mohammad.ahtasham@arbisoft.com>
2021-12-08 14:13:27 +05:00
Usama Sadiq
780a6f3c2d Revert "chore: install codejail from pypi (#29481)" (#29501)
This reverts commit 21551095ac.
2021-12-02 22:19:15 +05:00
Mohammad Ahtasham ul Hassan
21551095ac chore: install codejail from pypi (#29481)
* chore: install codejail from pypi

* chore: Updating Python Requirements

* chore: Updating Python Requirements

* fix: fixed failing tests

* fix: fixed pytest failures

* fix: fixed failing test bug

* Update mocks.py

Co-authored-by: edX requirements bot <testeng+edx-requirements-bot@edx.org>
2021-12-02 17:07:29 +05:00
M. Zulqarnain
834dabb399 feat: New codemods on OpenedX 2 (#28777) 2021-10-28 16:45:53 +05:00
Olivia Ruiz-Knott
5678b9e036 Merge pull request #28715 from edx/ork/MICROBA-1488_change-override-to-datetime-field
feat: Change override date to datetime
2021-09-13 09:23:46 -06:00
oliviaruizknott
59fefa10eb feat: Change override date to datetime
When first building the Certificate Date Override feature, I set up the
CertificateDateOverride model to store the override dates as Dates
instead of DateTimes.

Turns out this is not how edX typically handles dates, and it’s causing
some minor headaches around needing to convert values. Also, using just
Dates causes timezone issues.

MICROBA-1488
2021-09-10 14:42:36 -06:00
Albert (AJ) St. Aubin
a235f497ac feat: Remove email sent with program cert award.
[MICROBA-1466]
2021-09-10 13:57:52 -04:00
Albert (AJ) St. Aubin
a28f54bf4a feat: Added lms_user_id and email to data sent to Credentials for Program certs
[MICROBA-1466]
2021-09-08 15:05:09 -04:00
Albert (AJ) St. Aubin
18a3cdaeb8 fix: Correct an issue where cert available date was not sent to Credentials 2021-08-25 11:01:51 -04:00
oliviaruizknott
e15cc9ac12 fix: Change format of date_override post
Credentials needs the course certificate date override data in a
slightly different format than we were passing it before. Fix!
2021-08-19 14:42:32 -06:00
oliviaruizknott
e99029659c feat: Send date override to credentials
When sending a GeneratedCertificate to Credentials, send the associated
CertificateDateOverride (if there is one), or else None. This
will be triggered after any save of a GeneratedCertificate, and after
any save or deletion of a single CertificateDateOverride.

Credentials will eventually store its own copy of this date override, or
edit or remove exiting date overrides.
2021-08-17 12:22:27 -06:00
Matt Tuchfarber
d53d8e45a5 refactor: Merge the openedx certs app with lms one (#28435)
* refactor: Merge the openedx certs app with lms one

Move the certs API from openedx into the lms certificates app.
Functionally, this is a no-op. Cleanup will happen in a subsequent
commit. This is simply a move.
2021-08-11 10:25:55 -04:00
Matt Tuchfarber
622d56026c Certificate Display Settings revamp (round 2) (#28286)
feat: reimagine certificate display settings

The course settings `certificate_available_date` (CAD) and
`certificates_display_behavior` (CDB) were previously
acting indedependantly of one another. They now work in
tandem. This change:
- limits CDB to a dropdown
- removes "early_with_info" and adds "end_with_date"
- only takes CAD into account if "end_with_date" is selected
- Moves CDB to the main course schedule settings page
- updates CourseOverview model and CourseDetails objects to
validate these fields and choose sane defaults if they aren't
expected values

This work was previously done in bd9e7dd (complete with bugs), so this
version is toggleable via the ENABLE_V2_CERT_DISPLAY_SETTINGS setting
2021-08-02 11:30:15 -04:00
Thomas Tracy
666f1dadb8 [fix] Fix certificate available date sync (#28275)
* [fix] Fix certificate available date sync

We were syncing the course available date to every course in
credentials. Since credentials doesn't understand "self-paced" courses,
or course end behaviors, some certificates were time gated incorrectly.
This check make sure to check if the course is not self-paced, and has a
CDB of 'end' before syncing the CA date.
2021-07-26 14:30:06 -04:00
Matt Tuchfarber
d16c9a804c refactor: Move cert code to cert app
The `may_certify` function is used to determine whether a learner should
be able to see that their certificate is ready. It is therefore entirely
in the certificates domain. This remove may_certifiy and
may_certify_for_course from the xmodule and course_overview
apps and into the certificates app. The xmodule may_certify was not called
outside of tests prior to this, and the other's were easily moved.

In order to avoid circular imports, this also moved
certificate_info_for_user out of the model code and into an API
2021-07-21 15:56:19 -04:00
Matt Tuchfarber
63cb6a97ff Revert "feat: Reimagine certificate_availability_date and certificates_display_behavior" 2021-07-07 16:53:05 -04:00
Matt Tuchfarber
2a7106acfb feat: reimagine certificate display settings
The course settings `certificate_available_date` (CAD) and
`certificates_display_behavior` (CDB) were previously acting indedependantly
of one another. They now work in tandem. This change:
- limits CDB to a dropdown
- removes "early_with_info" and adds "end_with_date"
- only takes CAD into account if "end_with_date" is selected
- Moves CDB to the main course schedule settings page
- updates CourseOverview to validate these fields and choose sane
defaults if they aren't expected values

Certificates will now show under the following circumstances:
"Immediately upon passing"
certificate_availability_date = null
certificates_display_behavior = "early_no_info"

"End date of course"
certificate_availability_date = null
certificates_display_behavior = "end"

"A date after the course end date"
certificate_availability_date = <date>
certificates_display_behavior = "end_with_date"
2021-07-06 16:45:23 -04:00
Albert (AJ) St. Aubin
b23169560f fix: Corrects issue with refund logic and certificates.
[MICROBA-1307]

Before this change a user would not be auto refunded if they had a
certificate in a course with any status. This had unintended
consequences. This change updates the logic to only block auto refund
for statuses that we do not want to refund on such as downloadable.
2021-06-28 09:20:00 -04:00
Matt Hughes
8023a09191 fix: deleted courses do not break program details page
Sometimes learners have certificates in old course runs which've been
deleted. When this happens loading the learner's program progress can
result in 500 errors. This corrects those by choosing to count any
non-existent course the learner has certificates for as counting
towards program completion, effectively assuming that availability
dates have passed for all such courses.

Also fixes an error with a condition related to how we determine
whether an enrolled course is considered "in progress". The previous
version of the code had a bug that would result in a lot more courses
being marked "in progress" for the purpose of program completion than
actually were.

JIRA:EDUCATOR-5787
2021-06-09 10:58:00 -04:00
Matt Tuchfarber
e4d3c1a59b fix: remap explicit queues for program tasks
Program tasks got moved from tasks.v1.tasks.py to just tasks.py, but
the mapping was never updated.
2021-05-27 10:01:02 -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
Thomas Tracy
84c953948b MB-1167: calling course certificates api from LMS (#27552)
* [feat] calling course certificates api from LMS

Now that CourseCertificates in credentials have a field for the
available_date, we need to make sure we are always updating that field
when it changes in studio. This PR adds a call to a new Credentials API
that will update the field each time the date change signal fires.
2021-05-12 15:42:08 -04:00
Usama Sadiq
4f4be6538a BOM-2477: pylint warnings lint-amnesty (#27585) 2021-05-11 17:22:40 +05:00
Albert (AJ) St. Aubin
ee71594714 refactor!: Remove backpopulate_program_credentials in favor of using
notify_credentials command

In this PR we are removing a management command that has performance issues and duplicates logic not available in the notify_credentials management command.
2021-05-05 12:22:38 -04:00
Justin Hynes
35cfca0be1 Merge pull request #27357 from edx/jhynes/microba-1164_revoke-program-certs-bugfix
fix: fix bug with `revoke_program_certificates` task
2021-04-22 07:38:32 -04:00
Albert (AJ) St. Aubin
a1fe3d58dc [bug] Corrected issue where program dash showed incorrect completed
count

[MICROBA-1163]

This change will correct an issue in the Program Dashboard where a user
would see a course as completed, but not see their Certificate because
it was not available to them yet.
2021-04-21 16:03:33 -04:00
Justin Hynes
a7bc9d1cc1 fix: fix bug with revoke_program_certificates task
[MICROBA-1164]
* cast `course_key` as a string when scheduling the `revoke_program_certificates` task
* Update existing unit tests
* Move test utility method in test_tasks.py out from the middle of the test cases
* Fix spelling in test function name
2021-04-21 14:43:03 -04:00
Usama Sadiq
2b55959a8e refactor: apply lint-amnesty on existing violations 2021-04-20 23:51:31 +05:00
M. Zulqarnain
91d33611b1 refactor: pyupgrade in profile_images, programs, safe_sessions (#26953) 2021-03-22 17:51:13 +05:00
Régis Behmo
ae7d4994bf fix: deprecated waffle switch usage in test method 2021-03-19 17:08:57 +01:00
Matt Tuchfarber
ed8604534c (feat) Enable course cert sync for all courses
Removes waffle flag restriction for syncing certificate available dates
to the credentials service.
2021-03-16 14:31:11 -04:00
Matt Tuchfarber
a82489db8e fix tests 2021-03-12 14:59:44 -05:00
Matt Tuchfarber
7dd4a2b6fd fix: Pass date in cert date update signal
Because the available date update to the CourseOverview happens inside a
view's signal and we have atomic requests on, the read that was
happening inside the task happened *before* the write was commited to
the database. To avoid the unknown bugs that would come from disabling
atomic transactions for that view (since it's large), this passes the
date we want down through the signals and tasks so we can skip the DB
read at the end.
2021-03-12 13:57:50 -05:00
Matt Tuchfarber
09bb25bbcd exp: Add logging to course cert availability date
I believe there to be a race condition here that only manifests in a
non-devstack environment. Adding some logging to better diagnose.
2021-03-10 17:01:45 -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
6c97dfe1e5 Move cert date signals to avoid race conditions
COURSE_CERT_DATE_CHANGE was being called before saving the new data in
the course overview. The listeners were expecting to pull the data out
of the course overview, and thus were only right about half the time.
This moves the signal to trigger after the course publish signals are
handled.
2021-03-04 15:57:21 -05:00
Justin Hynes
03d788fc5b Log error when failing to award program certificate 2021-02-25 10:25:49 -05:00
Aarif
cfcb9330b3 replaced unittest assertions pytest assertions (#26568) 2021-02-22 12:24:33 +05:00
Matt Tuchfarber
63a144dda7 fix: Correct logging message to match function
The logging text was duplicated from a different function
2021-02-12 13:20:52 -05:00
edX requirements bot
a2635e9821 Python Requirements Update (#26463)
* Updating Python Requirements

* change namespaced_switch_name to name

Co-authored-by: Zulqarnain <muhammad.zulqarnain@arbisoft.com>
2021-02-10 16:25:34 +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
e159ab8e4d Pylint amnesty in openedx plugin_api, profile_images and programs apps (#26377) 2021-02-04 17:10:38 +05:00
Christie Rice
b1e5695acf MICROBA-921 Move emit_certificate_event() to utils (#26133) 2021-01-26 14:41:34 -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
Régis Behmo
a16cd71046 Start waffle namespace deprecation
By explicitly importing the legacy namespace classes, we make it clear
that we are using soon-to-be-deprecated classes. We will then be able to
start removing the legacy classes, one module at a time.
2020-12-03 16:06:14 +01: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
Awais Qureshi
7201edb11d Revert "Update routing config" (#25536)" (#25549)" (#25553)" (#25561)
This reverts commit db4c3b1210.
2020-11-11 00:13:47 +05:00