Commit Graph

117 Commits

Author SHA1 Message Date
Usama Sadiq
859df03049 refactor: ran pyupgrade on lms/djangoapps/courseware (#26737) 2021-03-12 12:15:58 +05:00
Kyle McCormick
9b37e7d0fe refactor: centralize checks for canonical courseware experience & URL (#26815)
Centralize the logic for choosing between
MFE and Legacy-frontend courseware within
three new functions:
* courseware_mfe_is_active
* courseware_mfe_is_visible
* courseware_legacy_is_visible

This allows us to create another new function:
* get_courseware_url
which can be called anywhere in LMS/Studio
to get the canonical URL to courseware
content (whether it be MFE or Legacy).

In future commits we we begin using
get_courseware_url throughout the platform.

TNL-7796
2021-03-08 15:24:16 -05:00
Kyle McCormick
e792242b5f refactor!: remove redundant ENABLE_COURSEWARE_MICROFRONTEND toggle (#26792)
The Django setting
FEATURES['ENABLE_COURSEWARE_MICROFRONTEND']
has been an additional gate to activating
usage of the Learning MFE for an Open edX
instance.

The toggle is redundant with the
`courseware.courseware_mfe`
Waffle flag. By removing it, we simplify our config
and simplify our path towards making the Learning MFE
the default courseware experience.

TNL-7796
2021-03-02 11:36:43 -05:00
Kyle McCormick
558d2eb52c refactor: centralize learning MFE URL-building logic (#26689)
In preparation for switching LMS/Studio over
from serving legacy courseware URLs in certain
places (for example, resume_course_url) to serving
learning micro-frontend URLs.

TNL-7796
2021-02-24 08:50:15 -05:00
Jawayria
03e6a874d0 Applied pylint-amnesty to courseware 2021-02-03 21:56:24 +05:00
Kyle McCormick
643fbe82a0 Downgrade REDIRECT_TO_COURSEWARE_MICROFRONTEND to CourseWaffleFlag (#25815)
The toggle was previously an ExperimentWaffleFlag,
which allows stable A/B testing but increases the toggle's
complexity. Since we do not plan an doing any more A/B
tests as part of the MFE rollout, we can 'downgrade' this
toggle to a CourseWaffleFlag, which still allows us to do
phased rollout and course-run-specific overrides.
2020-12-09 13:48: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
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
Régis Behmo
4586002956 Import waffle classes from edx_toggles instead of waffle_utils
Those classes were ported to edx_toggles. The imports remain in
waffle_utils.__init__ for backward compatibility.
2020-11-03 19:25:37 +01:00
Régis Behmo
13a70fcaa6 Deprecate COURSE_OUTLINE_PAGE_FLAG and UNIFIED_COURSE_TAB_FLAG
These flags are deprecated in favor or the DISABLE_* equivalent.
This allows us to get rid of the DefaultTrueWaffleNamespace class.
2020-10-27 10:20:41 +01:00
Tim McCormack
f29e418264 Revert "Revert "ARCHBOM-1494: Refer to custom attributes, not metrics, especially with edx-django-utils (#25010)" (#25025)" (#25055)
This reverts commit 986a448d9e.
2020-09-28 13:53:57 +00:00
Ahtisham Shahid
986a448d9e Revert "ARCHBOM-1494: Refer to custom attributes, not metrics, especially with edx-django-utils (#25010)" (#25025)
This reverts commit ba9ee4e151.

Fixed Style lint issue
2020-09-21 13:48:00 +05:00
Tim McCormack
ba9ee4e151 ARCHBOM-1494: Refer to custom attributes, not metrics, especially with edx-django-utils (#25010)
This uses the new names introduced in edx-django-utils
3.8.0 (edx/edx-django-utils#59), which we're already using, as
well as updating a few other locations where we incorrectly refer
to New Relic custom metrics instead of custom attributes.

Includes a couple of unrelated lint fixes in a file I modified.
2020-09-18 13:33:50 +00:00
Kyle McCormick
7e51232205 Revert "Bucket users regardless of enrollment in courseware MFE experiment" (#24700)
This reverts commit 06e04eff8c.

Omitting the course_key argument to ExperimentWaffleFlag.is_enabled
causes a 500 when the underlying experiment flag is enabled.

TNL-7405
2020-08-05 16:28:34 -04:00
stvn
06e04eff8c Bucket users regardless of enrollment in courseware MFE experiment 2020-07-27 11:46:26 -07:00
stvn
9e31d65afe Consolidate MFE redirect logic
Its ripe for confusion to have this logic split between two separate
methods. This consolidation should make things easier to understand and
hopefully, less issue prone.

We don't really benefit from having two methods here anyway, as one is
_only_ ever called by the other.

It's also misleading that the second helper, in `toggles.py`, _also_
checks the FEATURE flag, as well as the waffle flag.
2020-07-16 15:21:32 -07:00
Nicholas D'Alfonso
b454f9be1d AA-151 dates banner on course outline and refactor
- use new dates banner template on course outline page
- remove old banner from main.html
- let dates tab use new dates banner template
- remove dates banner completely from the courseware problem view
  on the web app
- use new banner on the courseware problem view on the mobile app
- update banner util to use get_course_blocks
2020-05-21 13:23:05 -04:00
Jeremy Bowman
5077479959 Remove shoppingcart code from courseware index page (#23977)
Remove code from the courseware index page that was only relevant if the shopping cart was enabled.
2020-05-19 11:11:34 -04:00
Simon Chen
262574b815 Move all the upgrade display logic into courseware.utils 2020-05-05 17:54:22 -04:00
Dave St.Germain
2c400184e4 Redirect to courseware MFE, including unit 2020-05-04 13:49:20 -04:00
Aarif
98af9ce418 remove useless-supression warnings 2020-05-01 19:42:15 +05:00
David Joy
7a400e2917 Factoring redirects out of check_course_access so it can be used with courseware_api (#23651)
TNL-7053

The courseware_api view will use check_course_access - which now returns AccessResponse objects, and all other uses of check_course_access will now use check_course_access_with_redirect, which is a drop-in replacement for the original check_course_access implementation.

We also added a few new helpers to access_utils:

- check_public_access is a replacement for allow_public_access, which now returns AccessResponse objects
 - check_enrollment checks if the learner is enrolled, and uses check_public_access to account for COURSE_ENABLE_UNENROLLED_ACCESS_FLAG
- check_survey checks whether there is a required survey that the learner must complete prior to accessing the course.

There are two new kinds of AccessError subclasses:

- SurveyRequiredAccessError
- EnrollmentRequiredAccessError
2020-04-15 10:29:24 -04:00
Nicholas D'Alfonso
ac9d2bfd30 AA-85 mobile reset dates
- render reset dates banner in webview for mobile app.
- improve banner redirect mechanism
2020-04-02 00:37:54 -04:00
David Ormsbee
5ea71beeb1 Make XBlock views/handlers non-atomic requests.
We're seeing slow commits on production for courseware_studentmodule
updates. Based on the slow queries during those times, we think it
might be because multiple worker processes are trying to update the
same rows from within long-running transactions (since courseware
is relatively slow).

The risk with this is that since the whole view execution is no
longer wrapped in a big implicit transaction, it's possible that
XBlock state will update and things that key off of that (e.g.
completion progress information or pre-req milestones) will fail
in a way that will leave the database in an unplanned-for state,
though this is already the case for those actions that trigger
asynchronous tasks like grades recalculation.

The query counts for the index view test were adjusted down
because save points count towards the total and we're no longer
setting them at the top level around the view as a whole.
2020-03-31 21:22:58 -04:00
Adam Butterworth
1f59463720 Swap courseware-mfe CourseWaffleFlag with ExperimentWaffleFlag (#23429)
TNL-7000
2020-03-23 13:46:42 -04:00
Nicholas D'Alfonso
8e77a822fe AA-73 courseware nonetype error
- ensure logic for displaying reset dealines banner in courseware
  is behind the relative dates waffle flag, only shows if the
  course is self paced, and handles the situation where no
  sequentials exist.
2020-03-17 14:05:15 -04:00
Nicholas D'Alfonso
3cee26feb4 AA-59 show reset dates banner on courseware page
- Also, only show banner if the course end_date has not already
  pass AND if the user is verified within the course.
2020-03-12 19:52:54 -04:00
Dave St.Germain
49c5d5194b Addressed review feedback 2020-03-09 11:28:48 -04:00
Dave St.Germain
28f33e1667 Defensive fix 2020-03-09 10:47:00 -04:00
Dave St.Germain
2f148496bf Redirect to learning microfrontend when the waffle flag is set, except for exams 2020-03-09 10:47:00 -04:00
David Ormsbee
ed9062f409 Create flag for Courseware MFE staff rollout.
Create the COURSEWARE_MICROFRONTEND_COURSE_TEAM_PREVIEW
CourseWaffleFlag (courseware.microfrontend_course_team_preview) to
enable us to roll out the new Courseware MFE as a preview to
select course teams without affecting their students. TNL-7117

This commit also fixes an issue where these links are shown in Old
Mongo courses (TNL-7116). Old Mongo is marked for deprecation
(DEPR-58), and is not intended to ever be supported by the new MFE.
2020-03-09 10:01:41 -04:00
David Ormsbee
767f16d795 Fix nested sequence display in Courseware MFE
Check to make sure that "activate_block_id" is actually a Unit
(VerticalBlock) before using it to build a link to the Courseware
MFE. We were previously sending sequence block keys here, causing
the MFE to render a whole sequence where only a unit was desired.

Fixes TNL-7115
2020-03-06 11:01:28 -05:00
David Ormsbee
979906275c Show Courseware MFE link to course staff.
Show a link the courseware MFE to course staff if the
ENABLE_COURSEWARE_MICROFRONTEND feature is enabled and the
REDIRECT_TO_COURSEWARE_MICROFRONTEND CourseWaffleFlag is active
for that course. Previously only global staff could see this link.

This commit also adds ENABLE_COURSEWARE_MICROFRONTEND to
lms/envs/common.py and makes this value True by default on
devstack, since that front end application should soon be part
of devstack: https://github.com/edx/devstack/pull/484

Related to TNL-6982 and TNL-7045.
2020-03-06 11:00:22 -05:00
Dave St.Germain
aa42751c7e Add button to switch to courseware MFE 2020-02-07 15:00:49 -05:00
Feanil Patel
6e3fe00fff Fix all E303 pep8 errors. 2019-12-30 12:25:38 -05: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
Matthew Piatetsky
3a54df511a show discount in sidebar and sock 2019-12-17 09:09:19 -05:00
David Ormsbee
aaf4c46645 Add ENABLE_COURSEWARE_SEARCH_FOR_COURSE_STAFF flag
Add an LMS feature flag to enable courseware search for course staff
only. TNL-6931
2019-12-05 15:14:26 -05:00
Calen Pennington
7bbf4ad15c Switch courseware.masquerade_as_student over to using a StaffAccessRule with query checking 2019-08-02 15:06:35 -04:00
Christie Rice
a9ebf91c4d REVMI-354 Revert masquerade changes (#21276) 2019-08-01 12:05:59 -04:00
Calen Pennington
136f58cb2d Add a staff-access specific bridgekeeper rule with full query support 2019-07-31 13:07:52 -04:00
Ayub khan
ffc9e14635 INCR-432 python3 compatibility 2019-07-30 15:12:56 +05:00
Calen Pennington
755a5c7db6 Augment content_type_gating tests to detect the failure case from the original REVMI-34 implementation 2019-05-16 15:17:33 -04:00
Calen Pennington
7eeff8bf9a Re-resolve REVMI-34 to allow any access error to put a message in the courseware 2019-05-15 11:29:00 -04:00
Nimisha Asthagiri
eb0791ec89 Inter-app API cleanup for Grades 2019-05-04 11:35:06 -04:00
Calen Pennington
78c8950ea3 Clean up a few remaining unicode format string errors 2019-02-20 15:28:14 -05:00
Pooja Kulkarni
9ddb1cc074 Implement public cohort
This PR is based on #19284 and is part of the
series of work related to the proposal #18134.

This PR avoids the assignment of
anonymous/unenrolled users to any cohort when
course is public. Anonymous or unenrolled users
will only see content that does not have a
content group assigned.
The "View Course" link to the course outline
is shown on the course about page for a course
marked public/public outline.
It also makes course handouts available for
public courses (not for public_outline).
This PR also hides the different warnings and
messages asking the user to sign-in and enroll
in the course, when the course is marked public.
It modifies the default public_view text to
include the component display_name when
unenrolled access is not available.
2019-02-07 21:42:21 +05:30
Matthew Piatetsky
6e81c84d8b fix unicode strings in lms/ part 1 2019-02-05 15:15:02 -05:00
Calen Pennington
040b60c38c Stop swallowing UnicodeEncodeErrors in courseware rendering 2019-02-01 09:22:54 -05:00
Matthew Piatetsky
9ba3e0c5a5 ensure content start date banner only shows for currently open sections 2019-01-17 12:32:08 -05:00