Commit Graph

327 Commits

Author SHA1 Message Date
Moeez Zahid
2f098c54e6 fix: Youtube has highest default stream priority (#31014) 2022-09-19 20:31:42 +05:00
Sarina Canelake
4a2f231302 fix: fix github url strings (org edx -> openedx) 2022-09-15 14:52:28 -04:00
Chris Chávez
ebd96cba8a fix: Bug showing hidden sections for learners of a public course fixed (#27925)
The bug is explained in https://openedx.atlassian.net/browse/CRI-233. Only is missing add the `VisibilityTransformer` in `get_blocks()` when the user is not enrolled to the course.
On the test, `html_block` is visible only for staff and `vertical_block` is a normal block. The new behaviour hides the `html_block` and show the `vertical_block` to anonymous users
2022-08-02 12:40:23 -04:00
Moeez Zahid
500cc9f0f0 fix: Add default video stream priority (#30810) 2022-07-29 22:31:47 +05:00
Moeez Zahid
3311225292 feat: Add stream_priority for videos (#30767)
* feat: Add stream_priority for videos
2022-07-29 13:33:42 +05:00
Eugene Dyudyunov
b4fecd620b refactor: rename toggle_warnings to toggle_warning (#30458)
Rename toggle_warnings to toggle_warning for consistency with setting_warning.
2022-05-24 11:47:31 -04:00
Feanil Patel
661949771a Merge pull request #30347 from raccoongang/remove-verified-track-cohort
FC-0001: Remove verified track cohort
2022-05-13 09:47:13 -04:00
Eugene Dyudyunov
52dd883a3c refactor: delete now unused FutureCourseWaffleFlag (#30367)
Remove temporary FutureCourseWaffleFlag class;
Update ora2 and edx-toggles to versions cleaned from the
LegacyWaffle* classes;
Replace `override_flag`s with `override_waffle_flag`;
Replace `override_switch`s with `override_waffle_switch` (where it's possible).
2022-05-13 08:48:42 -04:00
Eugene Dyudyunov
8bd43207ca refactor!: switch from LegacyWaffle* to modern waffles (#30330)
This is a first stage for removing the LegacyWaffle* classes.

LegacyWaffleFlag usage replaced with WaffleFlag;
LegacyWaffleSwitche usage replaced with WaffleSwitch;
New CourseWaffleFlag added to the temporary module __future__ as FutureCourseWaffleFlag;
Updated all the imports to use CourseWaffleFlag from the __future__ module;

BREAKING CHANGE: A number of toggle related constants (e.g. ENABLE_ACCESSIBILITY_POLICY_PAGE)
changed types. They were strings, and are now toggle instances (e.g. WaffleSwitch). Although the entire
refactor should be self-contained in edx-platform, if any plugins or dependencies were directly
using these constants, they will break. If this is the case, try to find a better publicized way of
exposing those toggles.
2022-05-05 12:03:10 -04:00
Eugene Dyudyunov
adb156ac03 test: update tests query counts 2022-05-03 13:16:43 +03:00
Michael Terry
4732c46985 fix: pass a CourseKey not a string to course_home_url 2022-04-15 08:59:56 -04:00
Michael Terry
ce5f1bb343 feat!: drop legacy course home view and related code
This was the "outline tab" view of the course. Preceded by the
course info view, succeeded by the MFE outline tab.

In addition to the course home view itself, this drops related
features:
- Legacy version of Course Goals (MFE has a newer implementation)
- Course home in-course search (MFE has no search)

The old course info view and course about views survive for now.

This also drops a few now-unused feature toggles:
- course_experience.latest_update
- course_experience.show_upgrade_msg_on_course_home
- course_experience.upgrade_deadline_message
- course_home.course_home_use_legacy_frontend

With this change, just the progress and courseware tabs are still
supported in legacy form, if you opt-in with waffle flags. The
outline and dates tabs are offered only by the MFE.

AA-798

(This is identical to previous commit be5c1a6, just reintroduced
now that the e2e tests have been fixed)
2022-04-14 15:18:31 -04:00
Michael Terry
a515c2e992 Revert "Drop legacy outline tab in favor of the MFE's version" 2022-04-14 14:16:29 -04:00
Michael Terry
be5c1a64d5 feat!: drop legacy course home view and related code
This was the "outline tab" view of the course. Preceded by the
course info view, succeeded by the MFE outline tab.

In addition to the course home view itself, this drops related
features:
- Legacy version of Course Goals (MFE has a newer implementation)
- Course home in-course search (MFE has no search)

The old course info view and course about views survive for now.

This also drops a few now-unused feature toggles:
- course_experience.latest_update
- course_experience.show_upgrade_msg_on_course_home
- course_experience.upgrade_deadline_message
- course_home.course_home_use_legacy_frontend

With this change, just the progress and courseware tabs are still
supported in legacy form, if you opt-in with waffle flags. The
outline and dates tabs are offered only by the MFE.

AA-798
2022-04-14 09:12:01 -04:00
Robert Raposa
29e50710dc feat: enhance cookie monitoring and logging
Contains a number of cookie monitoring changes.

Enhancements:
- Add sampling capability for cookie logging on headers
 smaller than the threshold. For details, see
 COOKIE_SAMPLING_REQUEST_COUNT.
- Add cookie header size to log message.
- Sort logged cookies starting with largest cookie.
- Move logging from Middleware request processing
 to response processing to ensure the user id is
 available for logging for authenticated calls.
- Added cookies.header.size.computed to check
 if there are any large hidden duplicate cookies.
 Can be compared against the cookies.header.size
 custom attribute.
- Add delimiters into logs to make it simpler to parse
 when the logging tools accidentally exports multiple
 log lines together.

Removed:
- Legacy cookie capture code. This code was dangerous to
  to enable and provided more limited insight than the
  newer logging, so this was removed to simplify the code.

Other refactors:
- Switched Middleware to use new Django format, rather
 than the Mixin.
- Moved tests to its own test class. Note: this
 middleware is likely to move to a separate
 library.

ARCHBOM-2055
2022-03-09 20:39:27 -05:00
Braden MacDonald
dcb7ef8821 feat: Read course indexes from MySQL, not MongoDB (#29184)
Description
This is a follow up to #29058 and #29413. This is the next step in moving part of the modulestore data (the course indexes / "active versions" table) from MongoDB to MySQL.

There are four steps planned in moving course index data to MySQL:

Step 1: create the tables in MySQL, start writing to MySQL + MongoDB  done
Step 2: migrate all remaining courses to MySQL  done
Step 3: switch reads from MongoDB to MySQL (this PR)
Step 4 (much later, once we know this is working well): stop writing to MongoDB altogether.
Supporting information
OpenCraft Jira ticket: MNG-2557

Status
 Tested with a large Open edX instance is in progress.

Testing instructions
Try making changes in Studio and verify that they work fine.

Deadline
None
2022-03-09 10:21:09 -05:00
Michael Terry
10ce36ea14 feat: hide Old Mongo courses from catalog
This is step one of removing access altogether. But first, let's
not advertise them.

DEPR-58
DEPR-123
2022-02-17 12:18:36 -05:00
Michael Terry
b905de757b test: more Old Mongo removal from tests
Convert more tests from MONGO_AMNESTY to SPLIT modulestores.

This is in preparation for just wholesale denying access to Old
Mongo, so I either converted tests to split or just deleted some
test variants that were Old Mongo specific. (e.g. ddt lines)
2022-02-11 14:50:30 -05:00
Michael Terry
cb1bb7fa64 test: switch default test store to the split store
It's long past time that the default test modulestore was Split,
instead of Old Mongo. This commit switches the default store and
fixes some tests that now fail:
- Tests that didn't expect MFE to be enabled (because we don't
  enable MFE for Old Mongo) - opt out of MFE for those
- Tests that hardcoded old key string formats
- Lots of other random little differences

In many places, I didn't spend much time trying to figure out how to
properly fix the test, and instead just set the modulestore to Old
Mongo.

For those tests that I didn't spend time investigating, I've set
the modulestore to TEST_DATA_MONGO_AMNESTY_MODULESTORE - search for
that string to find further work.
2022-02-04 14:32:50 -05:00
Julia Eskew
0eb0f99d00 feat: Add org-level waffle overrides to allow a waffle flag to be overridden for all
courses in a particular organization, without needing to make a separate course-level
waffle override for each individual course for an organization.
2022-01-28 08:00:18 -05:00
Jawayria
59002b5702 chore: Applied lint-amnesty on lms/djangoapps/{course_api, course_blocks} 2021-12-17 16:05:40 +05:00
Kshitij Sobti
9f4bc9900b feat: add discussions context to course blocks API (#29300)
Add a new course blocks transformer that adds discussion context for units.
2021-12-07 11:10:48 +05:00
M. Zulqarnain
d9a91d4c38 BOM-2781: Django codemods on LMS (2) (#28852)
* feat: Django codemods on LMS (2)
2021-11-11 17:52:57 +05:00
connorhaugh
b01e773d2b feat: cache course index queries (#29107)
* feat: store split modulestore's course indexes in Django/MySQL

Course outline generation is calling active_versions hundreds or even thousands of times on course_publish. In practice, the handling of a block requires a fetch of the course index. That requires a call to the active_versions table for each touching of a block. In larger courses, that can mean 1000s of calls to the db to retrieve them. A quick solution to this problem is to use a request cache, so we don't have to query the slow db every time and memoize the relevant data
[An example run can be seen here.](https://one.newrelic.com/launcher/nr1-core.explorer?platform[filters]=IihuYW1lIGxpa2UgJ3Byb2QtZWR4LWVkeGFwcCcgb3IgaWQgPSAncHJvZC1lZHgtZWR4YXBwJyBvciBkb21haW5JZCA9ICdwcm9kLWVkeC1lZHhhcHAnKSBhbmQgKG5hbWUgbGlrZSAnbG1zJyBvciBpZCA9ICdsbXMnIG9yIGRvbWFpbklkID0gJ2xtcycpIg==&platform[accountId]=88178&platform[timeRange][begin_time]=1626715880701&platform[timeRange][end_time]=1627320680701&pane=eyJuZXJkbGV0SWQiOiJhcG0tbmVyZGxldHMudHJhbnNhY3Rpb25zIiwiZW50aXR5R3VpZCI6Ik9EZ3hOemg4UVZCTmZFRlFVRXhKUTBGVVNVOU9mRFk1TVRNM05EUTROQSIsInNlbGVjdGVkU2VyaWVzIjoiZjAzYjNmNzY5OTQ0MjlmOTFhYWQ4MDBkNTEwZTU5MDM5OWNjMzNhMSIsImRyaWxsZG93biI6eyJ0cmFuc2FjdGlvbk5hbWUiOiJPdGhlclRyYW5zYWN0aW9uL0NlbGVyeS9jbXMuZGphbmdvYXBwcy5jb250ZW50c3RvcmUudGFza3MudXBkYXRlX291dGxpbmVfZnJvbV9tb2R1bGVzdG9yZV90YXNrIn19&cards[0]=eyJuZXJkbGV0SWQiOiJhcG0tbmVyZGxldHMudHJhbnNhY3Rpb24tdHJhY2UiLCJ0cmFjZUlkIjoiY2I2OGNkMDktZWI5Yi0xMWViLWJkY2QtMDI0MmFjMTEwMDBlXzI1MjU0MV8zMTgzMTMiLCJlbnRpdHlHdWlkIjoiT0RneE56aDhRVkJOZkVGUVVFeEpRMEZVU1U5T2ZEWTVNVE0zTkRRNE5BIn0=&sidebars[0]=eyJuZXJkbGV0SWQiOiJucjEtY29yZS5hY3Rpb25zIiwic2VsZWN0ZWROZXJkbGV0Ijp7Im5lcmRsZXRJZCI6ImFwbS1uZXJkbGV0cy50cmFuc2FjdGlvbnMifSwiZW50aXR5R3VpZCI6Ik9EZ3hOemg4UVZCTmZFRlFVRXhKUTBGVVNVOU9mRFk1TVRNM05EUTROQSJ9&state=d9946155-ea53-cb11-c1c0-cc873d6c7d39)

Useful information to include:
In theory, this should provide a minor performance boost to authors and learners, and be noticeable in the above function trace, once live on prod. Note, that in several places the cache must be invalidated, as to prevent a stale cache.


Co-authored-by: Braden MacDonald <braden@opencraft.com>
2021-10-27 13:53:10 -04:00
Braden MacDonald
6c85668099 feat: write split modulestore's course indexes to Django/MySQL
Split modulestore persists data in three MongoDB "collections": course_index (list of courses and the current version of each), structure (outline of the courses, and some XBlock fields), and definition (other XBlock fields). While "structure" and "definition" data can get very large, which is one of the reasons MongoDB was chosen for modulestore, the course index data is very small.

This commit starts writing course indexes (active_versions) to both MySQL and Mongo, but continues to read from MongoDB only.

By moving course index data to MySQL / a django model, we get these advantages:
* Full history of changes to the course index data is now preserved
* Includes a django admin view to inspect the list of courses and libraries
* It's much easier to "reset" a corrupted course to a known working state, by using the simple-history revert tools from the django admin.
* The remaining MongoDB collections (structure and definition) are essentially just used as key-value stores of large JSON data structures. This paves the way for future changes that allow migrating courses one at a time from MongoDB to S3, and thus eliminating any use of MongoDB by split modulestore, simplifying the stack.
2021-10-26 10:06:52 -07:00
Dillon Dumesnil
78fbd28f41 chore: AA-1058: Update edx-when version
Updates query counts for the additional query to look up the Schedule
in edx-when
2021-10-22 09:36:04 -04:00
Kyle McCormick
9bf266f717 fix: add missing __init__.py files 2021-10-21 09:54:22 -04:00
Usama Sadiq
9ee8df0980 fix: Remove pylint constraint and fix warnings (#28646) 2021-10-20 23:00:13 +05:00
David Ormsbee
ae124bd554 Revert "feat: store split modulestore's course indexes in Django/MySQL"
This reverts commit 96e5ff8dce.
2021-10-07 15:07:42 -04:00
Braden MacDonald
96e5ff8dce feat: store split modulestore's course indexes in Django/MySQL
Split modulestore persists data in three MongoDB "collections": course_index (list of courses and the current version of each), structure (outline of the courses, and some XBlock fields), and definition (other XBlock fields). While "structure" and "definition" data can get very large, which is one of the reasons MongoDB was chosen for modulestore, the course index data is very small.

By moving course index data to MySQL / a django model, we get these advantages:
* Full history of changes to the course index data is now preserved
* Includes a django admin view to inspect the list of courses and libraries
* It's much easier to "reset" a corrupted course to a known working state, by using the simple-history revert tools from the django admin.
* The remaining MongoDB collections (structure and definition) are essentially just used as key-value stores of large JSON data structures. This paves the way for future changes that allow migrating courses one at a time from MongoDB to S3, and thus eliminating any use of MongoDB by split modulestore, simplifying the stack.
2021-10-07 10:59:47 -04:00
Matthew Piatetsky
be5241a96d Merge pull request #28865 from edx/AA-905b
[AA-905] Refactor flag for recording user activity
2021-09-30 08:51:30 -04:00
Matthew Piatetsky
ae618151a9 fix: Remove debugging flag that is no longer necessary and refactor 2021-09-29 15:05:14 -04:00
Julia Eskew
cc3747add6 feat: Optimize the querying of course block dates when querying dates for use in a
course outline, which don't need block dates below the subsection level of a course.
Pass the course's published version to all the appropriate places where edx-when's API
is called - to allow edx-when to more efficiently cache queried/processed results.

TNL-8061
2021-09-27 12:02:59 -04:00
Usama Sadiq
023f4144ab fix: fix new pylint warnings (#28725) 2021-09-23 17:54:15 +05:00
Matthew Piatetsky
3200851563 start addressing comments 2021-09-20 13:08:12 -04:00
Matthew Piatetsky
bf6e135762 feat: Populate the course goals user activity table when a user visits course-specific pages 2021-09-16 12:30:36 -04:00
David Ormsbee
309cadc973 Revert "Use new version of edx-when." (#28684)
Reverting because of errors seen in proctoring. The error from splunk:

 File "/edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/edx_proctoring/views.py", line 590, in get
    data['onboarding_release_date'] = effective_start.isoformat()
AttributeError: 'NoneType' object has no attribute 'isoformat'

The effective date is coming from learning_sequences, which ultimately
comes from edx-when.
2021-09-08 11:05:35 -04:00
J. Victor Martins
6adf45df2f feat: Add permissions filter to list courses API
The new filter, called `permissions`, allows callers to filter courses
per access granted to the specified username.  Callers can now filter
courses per roles, actions, etc.
2021-09-07 14:41:50 -07:00
Julia Eskew
a4ba37b882 feat: Optimize the querying of course block dates when querying dates for use in a
course outline, which don't need block dates below the subsection level of a course.
Pass the course's published version to all the appropriate places where edx-when's API
is called - to allow edx-when to more efficiently cache queried/processed results.

TNL-8061
2021-09-02 17:45:13 -04:00
Azan Bin Zahid
1cce2e952d feat: add pact verification method 2021-08-24 14:59:46 +05:00
Ahtisham Shahid
20d631ff70 fix: added access for data researcher in courseware (#27935)
fix: fixed data researcher permissions on instructor dashboard
2021-06-17 10:57:46 +05:00
Shimul Chowdhury
2a8a58ae6b feat: add Course Membership API
The get_course_members API returns a dict of users associated with a course.
This is a potentially expensive operation on a large course, so there is a
control in place to limit its cost.  If a course has more than
settings.COURSE_MEMBER_API_ENROLLMENT_LIMIT enrollments, then the function
raises an OverEnrollmentLimitException.

This API was added to help implement the LTI 1.3 Names and Roles Provisioning
service.

Jira references: [BD-24] [BB-2726] [TNL-7330] 
Pull request: #25843
Co-authored-by: Giovanni Cimolin da Silva <giovannicimolin@gmail.com>
2021-06-03 09:38:13 -04:00
jawad khan
15f33dc1b2 revert: show empty container blocks from the course blocks api when called by mobile (#27707)
REVE-52 is merged and mobile
traffic from older app versions is < 5% of the mobile traffic.
Therefore we dont need changes from this PR 325fbe4eb2 (diff-c061bf405edf96531766b26cc2bcc2bb3639d851e5d9f844612c2ea57c35e56e)

LEARNER-8377
2021-05-25 20:30:26 +05:00
Dillon Dumesnil
6f773d1eca feat: AA-802: Update the BlockCompletionTransformer
We discovered a subsection that contained a unit without any content
inside, but because of our logic requiring children, it would never be
marked complete (meaning the subsection, section, and course could thus
never be marked complete). This fixes that by removing the children
check from setting completion, but first gating that code path on the
xblock being an aggregator (to prevent leaves from marking as true
simply because there are no children).

Test fixes include adding a test for the empty aggregator case as
well as some changes to not have an entire course marked complete
because they are all empty aggregators.
2021-05-14 11:22:07 -04:00
Michael Terry
12e9763446 Merge pull request #27487 from edx/mikix/fix-gated-content-check
fix: properly set contains_gated_content field on xblocks again
2021-05-03 11:50:40 -04:00
Michael Terry
6e52aafc8c fix: properly set contains_gated_content field on xblocks again
This has been broken for a couple months, preventing proper display
of verified-only assignments on the dates tab and elsewhere.

AA-780
2021-05-03 10:17:17 -04:00
Usama Sadiq
60f49d4048 refactor: pyupgrade second iteration (#27442) 2021-05-03 17:13:15 +05:00
Dillon Dumesnil
3a89ed4275 Merge pull request #27262 from edx/ddumesnil/switch-relative-dates-to-course-waffle-aa-677
refactor: AA-677: Switch relative dates to CourseWaffleFlag
2021-04-14 06:17:08 -07:00
Dillon Dumesnil
c9197d3cfc refactor: AA-677: Switch relative dates to CourseWaffleFlag
We have been bucketing all users into the relative dates experiment
since May 18, 2020. We no longer need to keep this as an
ExperimentWaffleFlag and can convert to a CourseWaffleFlag (so it
continues to support exemptions).
2021-04-08 10:12:54 -04:00
Kyle McCormick
a69567b18b feat: default staff to courseware MFE if active (via jump_to)
The /jump_to/ LMS endpoint is used in a number of places
to direct users to courseware. It currently only redirects to
Legacy courseware URLs, which then conditionally may
redirect to the Learning MFE.

Two issues with this:
1. Performance Impact: In most cases, going to Legacy first
   is just an extra redirect.
2. Confusion for Privileged Users: Neither course nor global
   staff are auto-redirected from the Legacy experience to the
   MFE. Thus, these priviliged users confusingly never see the
   MFE by default; they must always manually click into it.

This commit makes it so that /jump_to/ directs
users to whatever the default courseware experience is
for them. For staff of courses active in the new experience,
this will impact (at a minimum) the "View Live"
links in Studio, all links on the old and new LMS
course outline, and the "Resume" links on the course
dashboard. Learners should see no difference other than
a performance improvement when following courseware links
from the LMS.

This also adds an optional 'experience=[legacy|new]'
query param to /jump_to/, allowing us to specifically
generate Legacy courseware URLs for the
"View in Legacy Experience" tool.

TNL-7796
2021-04-07 10:24:58 -04:00