Commit Graph

23 Commits

Author SHA1 Message Date
M. Zulqarnain
16f600910b pyupgrade on lms edxnotes,email_marketing,experiments apps (#26531) 2021-02-22 15:42:32 +05:00
Carla Duarte
99163bdf2c AA-131: Allow anonymous users through course home MFE 2020-12-16 12:58:33 -05:00
Régis Behmo
216b99264a Upgrade waffle classes to the new edx-toggles API
Waffle classes no longer have namespaces. All features are moved to the
WaffleFlag/WaffleSwitch classes.

Here we use the edx_toggles.toggles.__future__ API, which is available
in 1.2.0. This means that we don't have to upgrade edx-toggles. We
should remove the __future__ imports as soon as we upgrade to 2.0.0.
2020-12-03 16:40:43 +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
Kyle McCormick
d1a775d3cd Use full names for lms.djangoapps imports (#25401)
* Use full LMS imports paths in LMS settings and urls modules
* Use full LMS import paths in Studio settings and urls modules
* Import from lms.djangoapps.badges instead of badges
* Import from lms.djangoapps.branding instead of branding
* Import from lms.djangoapps.bulk_email instead of bulk_email
* Import from lms.djangoapps.bulk_enroll instead of bulk_enroll
* Import from lms.djangoapps.ccx instead of ccx
* Import from lms.djangoapps.course_api instead of course_api
* Import from lms.djangoapps.course_blocks instead of course_blocks
* Import from lms.djangoapps.course_wiki instead of course_wiki
* Import from lms.djangoapps.courseware instead of courseware
* Import from lms.djangoapps.dashboard instead of dashboard
* Import from lms.djangoapps.discussion import discussion
* Import from lms.djangoapps.email_marketing instead of email_marketing
* Import from lms.djangoapps.experiments instead of experiments
* Import from lms.djangoapps.gating instead of gating
* Import from lms.djangoapps.grades instead of grades
* Import from lms.djangoapps.instructor_analytics instead of instructor_analytics
* Import form lms.djangoapps.lms_xblock instead of lms_xblock
* Import from lms.djangoapps.lti_provider instead of lti_provider
* Import from lms.djangoapps.mobile_api instead of mobile_api
* Import from lms.djangoapps.rss_proxy instead of rss_proxy
* Import from lms.djangoapps.static_template_view instead of static_template_view
* Import from lms.djangoapps.survey instead of survey
* Import from lms.djangoapps.verify_student instead of verify_student
* Stop suppressing EdxPlatformDeprecatedImportWarnings
2020-11-04 08:48:33 -05:00
Régis Behmo
16ce16e85e Deprecate ExperimentWaffleFlag.override method
This is part of a removal of the many override methods of toggle
flag/namespace classes. This allows us to remove imports of test modules
from production code.
2020-11-03 19:25:37 +01:00
Régis Behmo
307457a255 Simplify hack to obtain waffle module names
Instead of going up the stacktrace to find the module names of waffle
flags and switches, we manually pass the module __name__ whenever the
flag is created. This is similar to `logging.getLogger(__name__)`
standard behaviour.

As the waffle classes are used outside of edx-platform, we make the new
module_name argument an optional keyword argument. This will change once
we pull waffle_utils outside of edx-platform.

Note that the module name is normally only required to view the list of
existing waffle flags and switches. The module name should not be
necessary to verify if a flag is enabled. Thus, maybe it would make
sense to create a `add` class methor similar to:

    class WaffleFlag:
        @classmethod
        def add(cls, namespace, flag, module):
            instance = cls(namespace, flag)
            cls._class_instances.add((instance, module))
2020-09-14 09:30:24 +02:00
Kyle McCormick
61f8df5453 Clarify course_key/use_course_aware_bucketing nuances in docstrings 2020-08-10 11:57:02 -04:00
Kyle McCormick
662388c7db Allow omission of course_key in call to CourseWaffleFlag.is_enabled
This effectively evaluates the flag outside of the context of a course.
This was previously available through `.is_enabled_without_course_context`,
which has been removed in favor of simply `is_enabled()`.

This was done to make the CourseWaffleFlag interface more uniform with
that of WaffleFlag and ExperimentWaffleFlag and eliminate unecessary
branching when handling CourseWaffleFlags.
2020-08-10 11:57:02 -04:00
Kyle McCormick
b05948153a Add course-unawareness option to ExperimentWaffleFlag
For the Courseware MFE rollout experiment, we want users'
default buckets to be consistent across course runs.

ExperimentWaffleFlag advised that this could be done
by calling `.is_enabled(...)` without a course_key argument;
however, doing so breaks when uing the main_flag.BUCKET_NUM
scheme to apply bucket rules for a specific set of users
or courses.

This commit explicitly adds course-unaware-bucketing via
a new kwarg to ExperimentWaffleFlag.__init__ method.

Furthermore, it fixes ExperimentWaffleFlag.is_enabled(course_key=None)
to work as advertised, by means of calling
.is_enabled_without_course_context on its subordinate flags.

TNL-7405
2020-08-10 11:57:02 -04:00
Calen Pennington
bb12560233 Make the ExperimentWaffleFlag respect course masquerading when checking if it's active for a specific enrollment 2020-07-27 13:59:53 -04:00
Robert Raposa
77e490f057 ARCHBOM-1305: remove deprecated flag_undefined_default (#24426)
This is the final step in removing the deprecated
flag_undefined_default as explained by the following ADR:
https://github.com/edx/edx-platform/blob/master/openedx/core/djangoapps/waffle_utils/docs/decisions/0001-refactor-waffle-flag-default.rst

Notes:

* All uses of flag_undefined_default=False were always
  supposed to have been no-ops.
* All uses of flag_undefined_default=True that are removed
  in this PR have been replaced by migrations in past PRs.
* The temporary metric temp_flag_default_used id no longer
  reporting any data.

ARCHBOM-1305
2020-07-09 09:31:31 -04:00
Michael Terry
450072582e AA-137: Support courseware celebrations
- Add a new CourseEnrollmentCelebration model, which ties a
  course enrollment to some booleans about progress celebrations
- Add serialization of the new model to the existing courseware_api
  app's existing course info view
- Add new API in courseware_api to update a celebration model
2020-06-16 15:19:21 -04:00
Adam Butterworth
d066b43851 prefer is_experiment_on over _is_enabled 2020-04-14 09:33:15 -04:00
Adam Butterworth
b767d29561 Add docstring about overrides 2020-04-13 16:53:01 -04:00
Adam Butterworth
2459382fe3 Update is_experiment_on and add ExperimentWaffleFlag override test 2020-04-13 16:39:46 -04:00
Adam Butterworth
f5f6fc49ba Reenable Learning Sequence MFE redirect tests
TNL-7157 These tests may were the cause of intermittent test failures a couple weeks ago. Here they are reenabled after changing the way ExperimentWaffleFlag is overridden.
2020-04-13 14:22:20 -04:00
Adam Butterworth
1f59463720 Swap courseware-mfe CourseWaffleFlag with ExperimentWaffleFlag (#23429)
TNL-7000
2020-03-23 13:46:42 -04:00
Michael Terry
c4868d07bf enrollment_end support for experiments
Now in addition to enrollment_start support in ExperimentWaffleFlag,
you can set an enrollment_end date for your experiment. All enrollments
after this date will get the control experience.
2020-03-19 15:10:57 -04:00
Michael Terry
2e5f2f2be3 Fix error in experiment tracking
If the user is not logged in, the ExperimentWaffleFlag code was
raising an exception when trying to send an event to segment.

This is a quick fix to ignore anonymous users.
2020-03-16 17:40:55 -04:00
Michael Terry
605c986ff3 Mark experiment events as non interactive
Specifically, set the 'nonInteraction' segment event property to 1.
2020-03-06 14:46:35 -05:00
Michael Terry
24aaebdfa5 Use relative dates flag for dates widget v2
Switch from a separate waffle flag for the dates widget v2 work
and just use the relative dates experiment flag instead.
2020-03-05 16:38:07 -05:00
Michael Terry
e724a4bcb7 Add ExperimentWaffleFlag
This is a helpful class when running an experiment, to help
bucket users and keep track of which enrollments to consider
as part of the experiment.

AA-53
2020-03-03 14:39:02 -05:00