Commit Graph

12296 Commits

Author SHA1 Message Date
Arslan Ashraf
c2ca03ba94 Add annotation for ALLOW_HIDING_DISCUSSION_TAB feature flag 2021-03-10 16:32:56 +05:00
David Ormsbee
4c3fd76904 fix: add index to courseware_studentmodule for report performance.
= IMPORTANT WARNING =

This can be a VERY EXPENSIVE MIGRATION which may take hours or
days to run depending on the size of the courseware_studentmodule
table on your site. Depending on your database, it may also lock
this table, causing courseware to be non-functional during that
time.

If you want to run this migration manually in a more controlled
way (separate from your release pipeline), the SQL needed is:

  CREATE INDEX `courseware_stats` ON `courseware_studentmodule`
     (`module_id`, `grade`, `student_id`);

You can then fake the migration:
  https://docs.djangoproject.com/en/2.2/ref/django-admin/#cmdoption-migrate-fake

= Motivation and Background =

TLDR: This adds an index that will speed up reports like the
Problem Grade Report. This fixes a performance regression that
was unintentionally introduced in 25da206c.

I'm capturing the entire saga below, in case Open edX operators
need to dig into it.

The tale begins in November of 2012 (yes, seriously). We had an
inline analytics feature that would display a histogram to course
staff by each problem in the LMS, detailing how students did on
that problem (e.g. 80% got 2 points, 10% got 1 point, 10% got 0
points). The courseware_studentmodule table already had an index
on the module_id (a.k.a. module_state_key), but because there
were 100K+ students that had student state for some problems,
the generation of those histograms was still extremely expensive.
During U.S. Thanksgiving weekend in late November of 2012, that
load started causing operational failures on edx.org.

As an emergency measure, I manually added a composite index for
(module_id, grade, student_id) on courseware_studentmodule in
order to stabilize the courseware on edx.org. I did _not_ follow
up properly and add it in a migration file. Later on, the inline
analytics feature was removed entirely, so the index was considered
redundant (but again, it was not properly cleaned up).

Various reports were created over the years, some of which
relied on having an index for module_id. These ran fine because
there had long been an index for that field specifically.

In 2018, the courseware_studentmodule table for edx.org ran into
the 2 TB size limit that our old RDS instance had. We had a fair
amount of monitoring for various limits that we thought we might
run into, but the per-table limit took us by surprise. The Devops/
SRE person fielding that issue needed to free up space in a hurry
in order to make the courseware functional again. Examining the
database itself, he noticed that we had a module_id index that was
technically redundant because the composite index of (module_id,
grade, student_id) would cover queries that would otherwise use it.
Again, as an emergency measure, he dropped the index on module_id
in order to free up a little space and buy enough time to do a
proper move of the database to Aurora.

Devops-of-2018 being more disciplined than me-of-2012, the index
on module_id was removed in 25da206c. The intention was to make it
so that the state of the code would match what was live on edx.org.
But because the composite index was added in an ad hoc way, what
that really meant was that now queries involving module_id were
_only_ indexed by the (module_id, grade, student_id) composite
index that existed only on edx.org and no other Open edX instances.

We didn't realize this issue until months later. @blarghmatey
created an index to re-add the index for module_id:

  https://github.com/edx/edx-platform/pull/20885

The reason why we didn't accept this immediately is because
migrations for this table are very operationally risky and take
days to run. Faking this migration would have put edx.org even
more out of sync with the Open edX repo. Complicating this
somewhat was the fact that some folks still seem to be running a
variant of the inline analytics on their fork.

So in the end, we're going forward with this migration that brings
the code fully into sync with indexes on edx.org and covers the
obscure inline analytics histogram use case, while still covering
the module_id index needed for the fast generation of certain
reports that focus on a single problem.

Sorry folks.
2021-03-09 17:28:12 -05:00
Justin Hynes
32685a7999 MICROBA-1025 | Update cert_whitelist.py management command
[MICROBA-1025]
- Update management command to use the same logic that the Instructor Dashboard uses
- Fix bug in management command where processing stopped when encountering a user that did not exist
- Add more logging
- Add and update tests where needed
2021-03-09 14:45:44 -05:00
Christie Rice
d14cc21395 MICROBA-923 Add ADR on course certificate allowlist (#26923) 2021-03-09 11:34:12 -05:00
Christie Rice
4aff07ad82 MICROBA-923 Add method to generate V2 course certificates (#26898) 2021-03-09 11:02:19 -05:00
Kyle McCormick
05dbd83290 fix: streak celebration feature should require progress milestones (#26922)
In commit 9b37e7d0, the logic of
`streak_celebration_is_active` was accidentally
changed such that it no longer checks the
Progress Milestones waffle flag.
This commit fixes that.

Note: This also adds in a transitive check to
`courseware_mfe_is_active`,
which makes sense for Streak Celebration
and should not have any functional impact.
2021-03-09 10:23:13 -05:00
Jawayria
1a2245cd19 Merge pull request #26560 from edx/jawayria/bom-2352-6
BOM-2352: Removed unused imports from lms/djangoapps/{grades, instruc…
2021-03-09 19:04:03 +05:00
Jawayria
b31c18d6db BOM-2352: Removed unused imports from lms/djangoapps/{grades, instructor} 2021-03-09 17:25:54 +05:00
Jawayria
0c33d80ac0 Merge pull request #26580 from edx/jawayria/bom-2352-7
BOM-2352: Removed unused imports from lms/djangoapps/{instructor_anal…
2021-03-09 17:04:06 +05:00
Usama Sadiq
2adf8b759e refactor: ran pyupgrade on lms/djangoapps/commerce (#26734) 2021-03-09 14:21:08 +05:00
Usama Sadiq
afa102e125 refactor: ran pyupgrade on lms/djangoapps/course_api (#26735) 2021-03-09 12:54:42 +05:00
Usama Sadiq
7e275ec3ca refactor: ran pyupgrade on lms/djangoapps (#26523)
ran pyupgrade on course_Wiki, coursewarehistoryextended
2021-03-09 12:49:44 +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
Matjaz Gregoric
6204e5bcec Fix URL in forum notification post.
urljoin('my.domain.com', '/my/path') returns '/my/path'. We have to make
sure to use the full base url (starting with http(s)://) and not just
the site's domain.
2021-03-08 08:32:13 +01: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
Justin Hynes
8155190511 Merge pull request #26857 from edx/jhynes/microba-1038_fix-removal-bug
MICROBA-1038 | Don't check enrollment status when removing allowlist entries
2021-03-05 08:02:03 -05:00
Justin Hynes
a3a05bc440 MICROBA-1038 | Don't check enrollment status when removing allowlist entries
[MICROBA-1038]
- Today, we check if a learner is actively enrolled in a course-run before we add or remove them from the Instructor Dashboard allow list. We ran into an issue where we couldn't remove an entry from the list because the learner is no longer actively enrolled in the course-run. Update instructor dashboard logic to only check enrollment status when _adding_ a learner to the allow list.
2021-03-04 13:44:45 -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
Jawayria
bf9e498be7 Merge pull request #26536 from edx/jawayria/bom-2352-1
BOM-2352: Removed unused imports from lms/djangoapps/{badges, brandin…
2021-03-04 20:39:23 +05:00
Christie Rice
8c2ce91a15 MICROBA-1033 Remove temporary id verification code. Require users to have a current id verification. (#26834) 2021-03-04 09:08:56 -05:00
Usama Sadiq
519384edca refactor: ran pyupgrade on lms/djangoapps (#26733)
ran pyupgrade on bulk_enroll & ccx apps.
2021-03-04 16:00:19 +05:00
Awais Jibran
ce0fc3804d refactor: use q objects when fetching user using an identifier #26683 (#26823) 2021-03-04 15:16:54 +05:00
Usama Sadiq
a8449334af refac: ran pyupgrade on lms/djangoapps/branding (#26730) 2021-03-04 14:42:42 +05:00
Justin Hynes
05c82810e0 MB-1023 | Fix defect when removing allowlist entry on instructor dashboard
[MB-1023]
- Fix issue from recent refactor. Verify certificate is not none before attempting to invalidate the certificate.
- Add more logging
2021-03-03 13:14:01 -05:00
Christie Rice
1b1781247c MICROBA-1032 Remove command in favor of querying the db for more detailed info (#26787) 2021-03-03 09:33:21 -05:00
Sarina Canelake
e15e372233 Merge pull request #26772 from edx/sarina/DEPR-142-TNL-7522
Remove the "role of users being enrolled" field from Instructor Dashboard
2021-03-03 08:57:16 -05:00
Justin Hynes
251a9e74d6 Merge pull request #26799 from edx/jhynes/mb-908_move_checks_to_cert_djangoapp
MICROBA-1024 | Move checks to certificates app
2021-03-03 07:31:58 -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
Awais Jibran
589716144c refactor: use q objects when fetching user using an identifier (#26726)
* refactor: use q objects when fetching user using an identifier #26683

* Nit
2021-03-03 10:45:48 +05:00
Michael Terry
877e8f1e83 Merge pull request #26803 from edx/mikix/nudge2
feat: add 'external course updates' experiment flag
2021-03-02 15:46:54 -05:00
Justin Hynes
07837cf54e MICROBA-1024 | Move the allowlist and blocklist checks to certificates app
[MICROBA-1024]
- Move some of the recently added logic from the instructor app to the certificates app
- Attempt to not use other certificate models directly in the code I am touching, moving this logic to certificates as well.
2021-03-02 14:58:20 -05:00
Michael Terry
9570c1c72b feat: add 'external course updates' experiment flag
When this flag is enabled, users will be 50/50 bucketed into an
experiment where users get course highlights and nudges from an
external service (like sailthru or braze) rather than from
edx-platform via ACE.

AA-661
2021-03-02 14:51:45 -05:00
Christie Rice
f1ff795271 MICROBA-1032 Remove command in favor of using the allowlist (#26786) 2021-03-02 14:40:19 -05:00
Christie Rice
e5872cf8f2 MICROBA-1032 Add allowlist check and move tests (#26785) 2021-03-02 14:04:03 -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
Usman Khalid
dd96a2aa72 Convert Course, Section and Sequence XModules to XBlocks. (#25965) 2021-03-02 10:29:33 -05:00
M. Zulqarnain
ba86198519 pyupgrade on verify_students app (#26648) 2021-03-02 16:45:01 +05:00
Matthew Piatetsky
fe8e959559 Merge pull request #26765 from edx/AA-304
Check course outline and course date toggles in addition to courseware toggle for streak
2021-03-01 11:02:50 -05:00
Matthew Piatetsky
69ec9a2599 Check course home toggle in addition to courseware toggle 2021-03-01 09:40:02 -05:00
Usama Sadiq
7f6cabbf98 Ran pyupgrade on lms/djangoapps (#26519)
* refactor: ran pyupgrade on lms/djangoapps/bulk_enroll
Co-authored-by: M. Zulqarnain <muhammad.zulqarnain@arbisoft.com>
2021-03-01 17:13:18 +05:00
Usama Sadiq
cfb911966a Merge pull request #26520 from edx/usamasadiq/bom-2355-pyupgrade
Ran pyupgrade on lms/djangoapps-I
2021-03-01 15:54:01 +05:00
sarina
173bbce500 feat!: Remove the "role of users being enrolled" field from Instructor Dashboard
See DEPR-142
2021-02-28 18:40:16 -05:00
Carla Duarte
a90453b060 Merge pull request #26743 from edx/ciduarte/AA-684
AA-684: expose can_load_courseware to Course Home MFE
2021-02-26 09:21:02 -05:00
Usama Sadiq
27984285a7 Merge pull request #26502 from edx/usamasadiq/bom-2353-pyupgrade
Ran pyupgrade on lms/djangoapps
2021-02-26 14:07:17 +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
Christie Rice
efff6857a0 MICROBA-1026 Update allowlist to check if a user has ever had a verified id (#26715) 2021-02-25 15:32:17 -05:00
Carla Duarte
23700b3064 AA-684: sequence link to legacy or MFE 2021-02-25 13:48:50 -05:00
Christie Rice
fdc219a319 MICROBA-918 Unify course cert invalidation (#26691) 2021-02-25 10:30:18 -05:00
usamasadiq
84bb9faa3f refactor: ran pyupgrade on lms/djangoapps/certificates 2021-02-25 19:58:39 +05:00
usamasadiq
fb92051dee refac: ran pyupgrade on lms/djangoapps/badges 2021-02-25 18:15:27 +05:00