Commit Graph

277 Commits

Author SHA1 Message Date
Robert Raposa
96be45f1bd Merge pull request #27222 from edx/robrap/ARCHBOM-1721-toggle-doc-cleanup
ARCHBOM-1721: docs: update toggle docs
2021-04-05 10:47:55 -04:00
Feanil Patel
8e7144ae2e revert: "test: Update query counts."
This reverts commit c2eabf6cca.

We are changing this from a waffle setting to a django setting so we can
undo this query count bump.
2021-04-02 14:42:55 -04:00
Robert Raposa
8ef8b35a54 docs: update toggle docs
A variety of updates were made to improve the toggle documentation:
* Added comments to help ensure that the waffle(), waffle_switches(),
  waffle_flags() anti-pattern won't be contagious (copied).
* Some minor toggle_description updates.
* Removed empty toggle_target_removal_date annotations for
  non-temporary toggles.
* Removed empty optional toggle_warnings annotations.
* Removed empty optional toggle_tickets annotations.
* Removed deprecated toggle_category, toggle_status,
  and toggle_expiration_date annotations.
* Fixed some indents, use cases, and implementations.

ARCHBOM-1721
2021-04-01 21:58:29 -04:00
Feanil Patel
c2eabf6cca test: Update query counts.
The new WaffleFlag.is_enabled check in middleware increased query counts
for multiple tests.
2021-03-25 12:14:53 -04:00
Agrendalath
e571693455 Support EXCLUDED blocks in Block Completion Transformer
For now only the discussion blocks were supported. If we had a custom XBlock that specified `completion_mode = XBlockCompletionMode.EXCLUDED`, then it could never be marked as completed on the course outline page, despite being marked as such inside the learning sequence.
2021-03-22 16:21:43 +01:00
Agrendalath
5a27b5df39 Calculate completion for custom blocks on the Course Outline page
This adds support for displaying completion on the course outline page, to remove the discrepancies between this view and the learning sequence. It also simplifies course outline page by reusing existing APIs for determining completion state and finding the "Resume block"'s target.
2021-03-22 16:21:32 +01:00
Usama Sadiq
afa102e125 refactor: ran pyupgrade on lms/djangoapps/course_api (#26735) 2021-03-09 12:54:42 +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
Jawayria
2b943d93eb Merge pull request #26537 from edx/jawayria/bom-2352-2
BOM-2352: Removed unused imports from lms/djangoapps/{certificates, c…
2021-03-04 20:40:36 +05:00
jawad khan
787649ba81 LEARNER-8158 - Fixed descendants typo and added tests
LEARNER-8158 
Fixed descendants typo and added tests
2021-03-03 11:38:34 +05:00
jawad khan
137a271fd2 LEARNER-8158 - Fixed completion param issue (#26678)
* LEARNER-8158
Fixed completion param issue
- There is a case where we are sending requested_fields in params as comma separated list
e.g. requested_fields=children,show_gated_sections,graded,special_exam_info,completion.
- We didn't test for this case in first place and test cases were sending requested_fields as list.
- Now we can also handle this comma separated completion field which was getting ignored before.
2021-02-26 14:02:09 +05:00
Jawayria
b3b0b083d2 BOM-2352: Removed unused imports from lms/djangoapps/{certificates, commerce, course_api} 2021-02-23 19:38:25 +05:00
Aarif
a332aac1f6 replaced unittest assertions pytest assertions (#26541) 2021-02-19 12:27:11 +05:00
Michael Terry
1b9119859e AA-614: Add initial effort estimation block transformer 2021-02-18 08:31:19 -05:00
Jawayria
959aed9841 Resolved pep8 issues 2021-02-04 14:07:47 +05:00
Jawayria
e9b167e1fd Applied pylint-amnesty to course_api 2021-02-04 13:22:45 +05:00
jawad khan
8529e433b8 Added completion from root to child blocks api and increased version
* Added completion from root to child blocks api and increased version
Learner-8158
2021-02-02 19:51:14 +05:00
Régis Behmo
3a29cff016 Get rid of calls to set_request_cache_with_short_name
This method from the toggle legacy classes should not actually be
exposed to all. So we get rid of it by manually setting the cached
value. While we are at it, we convert the STORAGE_BACKING_FOR_CACHE
legacy waffle switch to its modern version. As the flag is not being
used elsewhere, this should not break anything.

We take the opportunity to modernize waffle switches from
block_structure.config: to do so we convert the INVALIDATE_CACHE_ON_PUBLISH and
RAISE_ERROR_WHEN_NOT_FOUND waffle switches from legacy classes to their modern
equivalents. These switches are not used outside of edx-platform, so this
change should not trigger any error.
2021-01-12 16:52:08 +01:00
Carla Duarte
03846e229d AA-545: Include has_scheduled_content in StartDateTransformer 2021-01-05 15:06:24 -05:00
Kyle McCormick
54d5f7f394 Course Blocks API: Fix handling of incorrectly-cased course keys (#25911)
Commit 7f59688 attempted to solve this using
`CourseOverview.course_exists`, but that check is case-
insensitive. This commit instead does a small refactor
to `lms.djangoapps.courseware.get_course` so that we can
handle a failed course lookup without broadly catching
a `ValueError`.
2020-12-18 11:26:29 -05:00
Kyle McCormick
7f59688f9b Course Blocks API: Return 403 instead of 500 for unknown courses (#25906)
Anonymous users (like crawlers) requesting non-existent courses
should get 403, just like logged-in users do. They instead raised
a ValueError.
2020-12-17 18:13:51 -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
Diana Huang
afeea75d9e Add changes to support ES7 and edx-search 2.0 back into the tree. 2020-11-17 13:23:13 -05:00
David Ormsbee
6a55b833dc Merge pull request #25045 from open-craft/gabor/expose-banner-image-url
[SE-3329] Expose banner image url in course API
2020-11-17 11:08:18 -05:00
Diana Huang
8d652e6a4b Revert "Merge pull request #25515 from edx/diana/edx-search"
This reverts commit 9714d7412f, reversing
changes made to 5bc7c3996b.
2020-11-13 13:16:16 -05:00
Diana Huang
33d0a18d56 Update edx-platform to use Elasticsearch 7.
This reverts commit b73f755487.
2020-11-13 11:13:01 -05:00
Gábor Boros
2a35410fe4 Expose banner image URL in course API
Banner image URL is exposed on the course list and course details API
endpoints. The new `banner_image_url` API field has both the relative
and absolute URLs for the image it represents, if it is set.
2020-11-13 15:35:13 +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
Manjinder Singh
c74b623948 Fixing code-annotations (#25539)
* Fixing code-annotations
2020-11-06 12:52:08 -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
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
3b127f8c92 Deprecate WaffleSwitch.override* methods
This allows us to get rid of the custom WaffleSwitch and
WaffleSwitchNamespace classes from waffle_utils in favour of
edx_toggles.toggles classes.
2020-11-03 19:25:37 +01:00
Régis Behmo
2307dff4c9 Deprecate WaffleFlag.override method
This allows us to get rid of waffle_utils' custom WaffleFlag method.
2020-11-03 19:25:37 +01:00
Feanil Patel
b73f755487 Revert "Feanil/edx search update (#25406)" (#25412)
This reverts commit 581b20056d.
2020-10-22 15:53:57 -04:00
Feanil Patel
581b20056d Feanil/edx search update (#25406)
OeX_ES-44:  Update edx-search elasticsearch.


* removes redundant doc_types from the lms/cms, replaces courseware
index with doc_types to two indices
* code polishing

* Use a new config variable for ES7 deployment. (#2226)

Co-authored-by: Golub-Sergey <1.golub.sergey.1@gmail.com>
Co-authored-by: Diana Huang <diana.k.huang@gmail.com>
2020-10-22 14:18:19 -04:00
Saleem Latif
43d0a67fa1 Request for field to specify locale in Django enterprise accounts 2020-10-20 17:56:22 +05:00
Kshitij Sobti
570d02a858 Allow anonymous access for course blocks API
Opens the course blocks API to public access, and allows anonymous users to
use the API to fetch data about public courses. Anonymous users need to
explicitly pass an empty username parameter to get the block data that is
visible to the public.
2020-10-03 02:07:25 +05:30
Troy Sankey
dded86d2ae Change subquery to JOIN in list_course_keys API 2020-09-25 12:54:37 -04:00
Troy Sankey
83a0327b92 Also exclude libraries from the list_course_keys API 2020-09-25 11:53:35 -04:00
Troy Sankey
e3cd6d55c4 Bypass calls to has_access() when listing courses
When listing courses for which a user has "staff" level access, bypass
calls to has_access() and use a hopefully more performant and simpler
access pattern that uses only a single ORM query and far less processing
per course.

Caution: this short-circuit implementation does not handle org-level
access grants.
2020-09-25 10:44:03 -04:00
Troy Sankey
7d3631a79b Add even more telemetry to the CourseIdListView
This time, we narrow our search down to paginate_queryset().
2020-09-23 14:12:53 -04:00
Troy Sankey
23b76a60b6 Add more monitoring to the CourseIdList view 2020-09-22 20:15:34 -04:00
Troy Sankey
98b19dd125 Add some tracing to the CourseListView endpoint 2020-09-18 18:28:00 -04:00
Régis Behmo
a4ba4ae45e Clarify many feature toggle annotations across all applications 2020-09-16 15:20:43 +02:00
Régis Behmo
7d93715880 Rename toggle_expiration_date to toggle_target_removal_date
This is part of the changes brought by code-annotations==0.7.0
2020-09-16 15:19:16 +02:00
Régis Behmo
98a13d6a7e Remove deprecated toggle_status annotation
This annotation is deprecated since code-annotations==0.7.0
2020-09-16 15:19:15 +02:00
Régis Behmo
ab0e21455a Get rid of the toggle_category annotation, now deprecated
Since code-annotations==0.7.0, this annotation is not used anymore.
2020-09-16 15:16:13 +02:00
Régis Behmo
7dc460d50a Wrap toggle annotation lines with multiline comments
This takes advantage of the new multiline annotation format with
single-line comment prefix, from code-annotations.
2020-09-16 15:16:12 +02:00
Régis Behmo
c8911b6282 Document lms/djangoapps/course_api feature toggles 2020-09-16 15:15:45 +02: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