143 Commits

Author SHA1 Message Date
Daniel Wong
cd6faeb966 Follow-up to PR 36789 (#37751)
* refactor(certificates): replace direct model imports with data classes and APIs

* fix: use Certificates API to create certificates

* docs: update docstring for get_certificate_for_user

* fix: remove trailing whitespace

---------

Co-authored-by: coder1918 <ram.chandra@wgu.edu>
Co-authored-by: Deborah Kaplan <deborahgu@users.noreply.github.com>
2026-01-08 13:03:46 -05:00
Tarun Tak
18d5abb2f6 chore: Replace pytz with zoneinfo for UTC handling - Part 1 (#37523)
First PR to replace pytz with zoneinfo for UTC handling across codebase.

This PR migrates all UTC timezone handling from pytz to Python’s standard
library zoneinfo. The pytz library is now deprecated, and its documentation
recommends using zoneinfo for all new code. This update modernizes our
codebase, removes legacy pytz usage, and ensures compatibility with
current best practices for timezone management in Python 3.9+. No functional
changes to timezone logic - just a direct replacement for UTC handling.

https://github.com/openedx/edx-platform/issues/33980
2025-10-28 16:23:22 -04:00
Mubbshar Anwar
f32b08b753 feat: add new param in url (#36458)
Add new param in ecommerce url to calculate program price based on course keys

SONIC-918
2025-03-28 14:19:36 +05:00
Deborah Kaplan
ce8d3211f9 chore: improving programs rest API docs, type hints (#36438)
* chore:  improving programs rest API docs, type hints

reformatting the docstrings  so they appear correctly in the  openAPI
docs.
* moving them into the `GET`
* some cleanup and simplification of language
* removing real data that refers to specific hosts

regenerated the open API documentation.

also adding type hints to the API and telling `mypy`  to check this
file.  This was primarily because these models are confusing enough in
order to verify that the documentation was correct I had to do a lot of
jumping through the code.

FIXES: APER-3950
2025-03-25 09:39:25 -04:00
Muhammad Noyan Aziz
ca463f918d SONIC-917: Added pluggable_override on `get_program_price_info` util (#36382)
* feat: add override for one click purchase eligibility

* refactor: remove extra line

* chore: move service worker inside util

* refactor: pylint issue

* fix: pylint errors

* fix: pycodestyle

---------

Co-authored-by: Muhammad Noyan  Aziz <noyan.aziz@A006-01474.local>
2025-03-20 15:37:17 +05:00
Mohammad Ahtasham ul Hassan
6a63cfcaa4 feat: add override option to upgrade CTA utils and add course_run_key identifier (#35441)
* feat: add override option to upgrade CTAs and send course_run_key identifier
2024-09-16 13:15:51 +05:00
Juliana Kang
51d538cbe7 fix: Remove B2C Subscriptions (#35303)
REV-3697
2024-09-04 14:01:45 -04:00
Deborah Kaplan
360159c642 feat: linting before touching all these files (#35108)
* feat:  linting before touching all these files

All these files are old enough, relative either to our current linting
rules or our current linter automation,  that modifying anything in them
either makes the linter cranky or wants to reformat  the entire file.
Rather than mixing cleanup with code changes, this commit just lints
this set of files to our current standards.
2024-07-10 14:29:53 -04:00
Nawfal Ahmed
80d151b404 feat: add marketing url to subscription upsell (#32560) 2023-06-23 12:54:15 +00:00
Nawfal Ahmed
6a5c1bbf44 feat: update subscription enrollment alert (#32414) 2023-06-12 13:07:43 +00:00
Mohammad Ahtasham ul Hassan
acc9dac627 fix: fix manage subs url, add orders and subs url (#32126)
* fix: fix manage subs url, add orders and subs url
2023-05-16 09:35:22 +05:00
Pooja Kulkarni
9245bc0f76 refactor: rename descriptor -> block within openedx/core/djangoapps
Co-authored-by: Agrendalath <piotr@surowiec.it>
2023-04-26 17:10:54 +02:00
Mohammad Ahtasham ul Hassan
2a7b400770 fix: fix buy_subscription_url to use get method (#32079)
* fix: fix buy_subscription_url to use get method
2023-04-18 15:31:32 +05:00
Mohammad Ahtasham ul Hassan
e973266b2f feat: fetch program subscription details (#32023)
* feat: fetch program subscription details
2023-04-14 16:33:12 +05:00
Usama Sadiq
4734f9f16e fix: bump pylint version (#31084) 2022-10-27 12:19:09 +05: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
muhammad-ammar
c35025fd9d feat: api to fetch all programs where an enterprise learner is enrolled 2022-03-04 17:42:30 +05:00
Sameen Fatima
0d9e845f1b feat: Created an API to fetch progress details about a learner's program (#29975) 2022-03-04 16:11:28 +05:00
Jawayria
7663592aa6 chore: Applied lint-amnesty on openedx/core/djangoapps 2021-12-09 13:37:27 +05: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
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
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
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
M. Zulqarnain
91d33611b1 refactor: pyupgrade in profile_images, programs, safe_sessions (#26953) 2021-03-22 17:51:13 +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
Kyle McCormick
151bd13666 Use full names for common.djangoapps imports; warn when using old style (#25477)
* Generate common/djangoapps import shims for LMS
* Generate common/djangoapps import shims for Studio
* Stop appending project root to sys.path
* Stop appending common/djangoapps to sys.path
* Import from common.djangoapps.course_action_state instead of course_action_state
* Import from common.djangoapps.course_modes instead of course_modes
* Import from common.djangoapps.database_fixups instead of database_fixups
* Import from common.djangoapps.edxmako instead of edxmako
* Import from common.djangoapps.entitlements instead of entitlements
* Import from common.djangoapps.pipline_mako instead of pipeline_mako
* Import from common.djangoapps.static_replace instead of static_replace
* Import from common.djangoapps.student instead of student
* Import from common.djangoapps.terrain instead of terrain
* Import from common.djangoapps.third_party_auth instead of third_party_auth
* Import from common.djangoapps.track instead of track
* Import from common.djangoapps.util instead of util
* Import from common.djangoapps.xblock_django instead of xblock_django
* Add empty common/djangoapps/__init__.py to fix pytest collection
* Fix pylint formatting violations
* Exclude import_shims/ directory tree from linting
2020-11-10 07:02:01 -05:00
Matt Tuchfarber
3cea568719 Fix variable reuse bug in program enrollment check
Reuse of the variable paid_modes was causing the code to follow an
incorrect path. Changed the filtering version of the variable to
paid_modes_only. Had to keep both variables temporarily until I can fix
plugin code that uses this API.
2020-09-09 14:05:48 -04:00
Matt Tuchfarber
f90bcabcd7 Add debugging for programs enrollment 2020-09-04 12:05:06 -04:00
Matt Tuchfarber
c4cf0b9bb7 Refactor program type enrollment checks
Checking if a user was enrolled in a program type was using the `name`
field which is subject to be translated. This change allows for us to check by
the type's slug which will be constant. This also includes the addition
of api.py files for the course_modes, catalog, and programs apps.
2020-08-26 14:29:39 -04:00
Matt Tuchfarber
cbeab67833 Use demographics api for dashboard banner
Make demographics collection banner on dashboard use new demographics
API which checks enterprise as well. Also expose serialization of
CourseEnrollments.
2020-07-17 13:20:42 -04:00
Albert (AJ) St. Aubin
77f3d9099b [MICROBA-437] Add api to determine demographics status based on user data 2020-07-14 12:58:07 -04:00
Jansen Kantor
f4a2303013 EDUCATOR-5043: remove grades from program progress page (#23940)
* remove grades from program progress page
2020-05-08 14:46:20 -04:00
Matthew Piatetsky
68777a270a Modify the program dashboard to make it pass the bundle parameter which is necessary to see the program discounted price
REV-1123
2020-04-02 11:34:02 -04:00
Feanil Patel
9cf2f9f298 Run 2to3 -f future . -w
This will remove imports from __future__ that are no longer needed.

https://docs.python.org/3.5/library/2to3.html#2to3fixer-future
2019-12-30 10:35:30 -05:00
adeelehsan
c7172c1d69 Uri added for explore new program
PROD-1004
2019-11-26 17:28:45 +05:00
Christie Rice
3d062aab62 REVMI-354 Add enroll_in_course permission (#21243)
* REVMI-354 Add enroll_in_course permission

* Fix test
2019-08-01 08:37:41 -04:00
arbisoft
86a5066991 Fixing python-modernize issues. 2019-07-10 14:35:29 +05:00
Amit
087250cff7 INCR-250: Make compatible with Python 3.x without breaking Python 2.7… (#20534)
* INCR-250: Make compatible with Python 3.x without breaking Python 2.7 support --> openedx/core/djangoapps/programs

* INCR-250: Disable pylint warning and replace _f placeholder with actual name

* INCR-250: pylint format correction and fix over length line limit
2019-06-11 10:17:52 -04:00
Nimisha Asthagiri
eb0791ec89 Inter-app API cleanup for Grades 2019-05-04 11:35:06 -04:00
Zainab Amir
97e26785e3 Change attribute in ProgramDataExtender log warning
The variable course_run is not an attribute of object
ProgramDataExtender and should not be accessed using self.

LEARNER-6734
2019-04-10 12:11:31 +05:00
Jason Myatt
09d51b00b5 Filter out certificates for nonexistent courses
LEARNER-7086. Uses a new model manager for GeneratedCertificate that excludes
certificates whose course_id does not correspond to a valid CourseOverview
2019-03-08 11:28:41 -05:00
Emma Green
57b7150b09 add course to program caching 2019-02-22 13:18:23 -05:00
emma-green
cbf3f78325 Revert "WIP:Cache course runs to programs" 2019-02-20 12:03:07 -05:00
Emma Green
f2139bbe2f add courses to programs to cache 2019-02-19 15:17:23 -05:00
Matthew Piatetsky
f294b1a374 fix unicode strings in openedx/ part 1 2019-02-13 10:47:35 -05:00
Emma Green
ce7b094cfb don't error out to user programs with really old course runs not in lms 2018-10-19 13:25:28 -04:00
Michael Terry
c90edab169 Bundle an SQL query for performance
We were doing many individual SQL queries for certificates when
awarding program certs. It's possible this was contributing to
high SQL load. Instead, let's bundle those queries up into a larger
one.

LEARNER-6490
2018-10-05 12:43:47 -04:00
Diana Huang
755ebc8c7f Send program cert visible_date
When sending a program cert to Credentials, also send along a
calculated visible_date along with it.

LEARNER-6262
2018-09-04 16:05:24 -04:00