Commit Graph

4136 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
ba4d98898e Merge pull request #27231 from edx/feanil/more_safe_sessions_updates
fix: Reduce safe-sessions false alarms.
2021-04-02 14:45:22 -04:00
Feanil Patel
4f725aa152 test: Add a test for setup_masquerade.
Test to verify the side-effects of calling this function since we now
rely on one of them in the SafeSessionMiddleware.
2021-04-02 14:19:10 -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
Bianca Severino
333591301d Merge pull request #27203 from edx/bseverino/remove-proctoring-waffle-flags
[MST-678] Remove proctored exam resume waffle flag
2021-03-31 14:58:20 -04:00
Bianca Severino
73c5866678 fix: remove proctored exam resume waffle flag 2021-03-31 14:14:09 -04:00
Christie Rice
8f50edea6f feat: Implement generation of regular V2 course certificates (#27189)
MICROBA-1039
2021-03-31 14:12:19 -04:00
Asad Iqbal
d5e13195b7 Fix: Find the submission history using learner's email address along with username (#25642)
Co-authored-by: asadiqbal <aiqbal@edx.org>
Co-authored-by: asadiqbal08 <asad.iqbal@arbisoft.com>
2021-03-31 08:46:55 -04:00
Christie Rice
8198606138 feat: Refactor code to check both regular and allowlist V2 certs (#27156)
MICROBA-1039
2021-03-30 10:23:23 -04:00
Michael Terry
5d9e7e9fe5 fix: don't count hierarchy blocks as complete for assignments
When considering whether a subsection is complete as an assignment,
skip any "hierarchy" types (sequential, vertical, etc) that don't
have children. If the user can't see the content, don't risk
marking it as complete.

AA-726
2021-03-29 16:06:11 -04:00
edX requirements bot
41c1d237eb Python Requirements Update (#27094)
* Updating Python Requirements

* fix proctoring test

Co-authored-by: Zulqarnain <muhammad.zulqarnain@arbisoft.com>
2021-03-22 15:15:46 +05:00
Bianca Severino
557029b0db Revert edx-proctoring to 3.7.12 2021-03-19 09:38:43 -04:00
Bianca Severino
3af3f5bc11 Update edx-proctoring to 3.7.13 2021-03-17 13:18:16 -04:00
Kyle McCormick
1f392bdc3e fix: render_xblock was denying access to staff masquerading as learners (#27017)
The render_xblock view, which powers the Learning
MFE (among other things) returned a 404 when un-
enrolled course staff users tried to load it while
masquerading as learners. This was because we
checked course access after enabling the
masquerading context, which triggered a redirect-
to-enrollment exception.

The fix is simply to enable the masquerading
context after checking course access.
Content-level behavior and access is still
calculated within the masquerading context,
as intended.

TNL-7989
2021-03-15 16:50:33 -04:00
Carla Duarte
f50b71b03c replace six with str 2021-03-12 15:32:05 -05:00
Carla Duarte
c996f58e9d Merge pull request #26978 from edx/ciduarte/AA-213
AA-213: create progress tab mfe waffle flag
2021-03-12 13:27:06 -05:00
Carla Duarte
403358e09f AA-213: create progress tab mfe waffle flag 2021-03-12 10:08:34 -05:00
David Ormsbee
bebcbef3dd Merge pull request #26973 from open-craft/symbolist/convert-to-xblock
[BD-04] Create CustomTagTemplateBlock, convert TranslateCustomTagDescriptor to XBlock and remove RawDescriptor
2021-03-12 09:17:59 -05:00
Usama Sadiq
82406e970a reafctor: ran pyupgrade on lms/djangoapps/courseware (#26739) 2021-03-12 14:43:44 +05:00
Usama Sadiq
b1b3ba9c81 refactor: ran pyugprade on lms/djangoapps/courseware (#26738) 2021-03-12 12:16:46 +05:00
Usama Sadiq
859df03049 refactor: ran pyupgrade on lms/djangoapps/courseware (#26737) 2021-03-12 12:15:58 +05:00
Carla Duarte
dbf2b86f25 Merge pull request #26928 from edx/ciduarte/hack
AA-671: Course Home MFE Progress Tab API cleanup
2021-03-11 16:09:48 -05:00
Carla Duarte
99f73312b8 Progress Tab 2021-03-11 15:43:58 -05:00
Usman Khalid
78cd8be24d XMLModuleStore should use HiddenDescriptor instead of RawDescriptor.
In https://github.com/edx/edx-platform/pull/25955 `HiddenDescriptor`
(which was a subclass of `RawDescriptor` with a custom `student_view()`)
was converted to an XBlock. It is used as the `default_class` by the
`CachingDescriptorSystem` classes. However `RawDescriptor` is still
being used by `XMLModuleStore`. This has been replaced by
`HiddenDescriptor` as well.
2021-03-11 22:20:33 +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
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
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
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
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
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
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
Matthew Piatetsky
69ec9a2599 Check course home toggle in addition to courseware toggle 2021-03-01 09:40:02 -05:00
Christie Rice
57f9005e57 MICROBA-918 Add allowlist check (#26584) 2021-02-24 09:07:04 -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
Michael Terry
23f34031d1 Merge pull request #26663 from edx/mikix/enable-schedules
feat: turn on schedule creation by default
2021-02-23 14:34:11 -05:00
Michael Terry
74887aa216 feat: turn on schedule creation by default
This commit removes several waffle toggles that have been enabled
on edx.org for years. It's time to remove the rollout gating for
these features and enable them by default.

This doesn't directly change any behavior. But it does create new
database objects by default now and allows for enabling other
schedule based features more easily.

Specifically, the following toggles were affected.

schedules.create_schedules_for_course
- Waffle flag removed as always-enabled
- We now always create a schedule when an enrollment is created

schedules.send_updates_for_course
- Waffle flag removed as always-enabled
- Course update emails are sent as long as the ScheduleConfig
  allows it.
- This is not a change in default behavior, because ScheduleConfig
  is off by default.

dynamic_pacing.studio_course_update
- Waffle switch removed as always-enabled
- Course teams can now always edit course updates directly in Studio

ScheduleConfig.create_schedules
ScheduleConfig.hold_back_ratio
- Model fields for rolling out the schedules feature
- Schedules are now always created
- This commit only removes references to these fields, they still
  exist in the database. A future commit will remove them entirely

This commit also adds a new has_highlights field to CourseOverview.
This is used to cache whether a course has highlights, used to
decide which course update email behavior they get. Previously every
enrollment had to dig into the modulestore to determine that.
2021-02-23 12:34:02 -05:00
M. Zulqarnain
42fc6aef03 Upgrade django-ipware (#24827) 2021-02-23 18:14:17 +05:00
Jawayria
0e621d3289 Merge pull request #26538 from edx/jawayria/bom-2352-3
BOM-2352: Removed unused imports from lms/djangoapps/{course_blocks, …
2021-02-23 16:09:22 +05:00
Michael Roytman
0b624bdb71 Merge pull request #26637 from edx/mroytman/MST-617-bump-version-edx-proctoring-3.6.0
[MST-614] bump version of edx-proctoring to 3.6.0
2021-02-22 13:26:37 -05:00
Jawayria
a383845b01 BOM-2352: Removed unused imports from lms/djangoapps/{course_blocks, course_goals, course_home_api, courseware} 2021-02-22 21:44:42 +05:00
Matthew Piatetsky
3b45a72b8e Create backend for three day streak celebration
This feature uses the first_day_of_streak, last_day_of_streak and last_streak_celebration fields to determine whether the user should see a celebration.
AA-304
2021-02-22 10:50:33 -05:00
Michael Roytman
71456cb2a4 feat: Install version 3.6.0 of the edx_proctoring library into edx-platform.
This release adds a new permission check when rendering the practice proctored exam view. If a learner is not in a paid enrollment track, the learner will no longer be able to use proctoring software in a practice proctored exam. As with other proctored exams, learners not in a paid enrollment track will see the exam content. This uses the 'can_take_proctored_exam' permission.
2021-02-22 10:23:36 -05:00
usamasadiq
96f0915b0f Fixed new pylint warnings.
use generator in any/all()
disable not-callable warnings
disable no-member warnings
Suppressed smaller pylint warnings
Pin edx-proctoring==3.5.0
2021-02-22 16:36:53 +05:00
Aarif
0112339b20 replaced unittest assertions pytest assertions (#26543) 2021-02-19 11:58:27 +05:00
Usman Khalid
62ed654b31 Convert LTIModule into LTIBlock. (#25713) 2021-02-16 09:09:13 -05:00
David Ormsbee
691472e475 [feat]: Don't use Mathjax if an HTMLBlock has no math. (#26478)
Mobile apps load HTML (and other) XBlocks individually using the
render_xblock endpoint. This is an attmept to reduce the number
of requests and JS processing needed to do so by detecting when
we have math content in HTMLBlocks and only adding the Mathjax
resources when necessary.

This is controlled by the "courseware.optimized_render_xblock"
CourseWaffleFlag. For maximum safety, we currently only optimize
in this way when directly hitting HTMLBlocks, and not for
ProblemBlock or VerticalBlock.

This was made as part of edX's Hackathon XXV.
2021-02-11 13:31:17 -05:00
alangsto
9104983369 update edx-proctoring version (#26472)
updated for quality
2021-02-10 13:41:17 -05:00
Manjinder Singh
cd60646926 fix: Switch anonymous user ID hash from md5 to shake (#26198)
Now that we always return an existing value from the DB rather than trusting that ID generation is deterministic and constant over time, we're free to change the generation algorithm.

Our long term goal is to switch to random IDs, but we need to first investigate the uses of save=False. In the meantime, this is a good opportunity to move away from MD5, which has a number of cryptographic weaknesses. None of the known vulnerabilities are considered exploitable in this location, given the limited ability to control the input to the hash, but we should generally be moving away from it everywhere for consistency.

This change should not be breaking even for save=False callers, since those calls are extremely rare (1 in 100,000) and should only occur after a save=True call, at which point they'll use the stored value. Even if this were not true, for a save=False/True pair of calls to result in a mismatch in output, the first of the calls would have to occur around the time of the deploy of this code.

Co-authored-by: Tim McCormack <tmccormack@edx.org>
 
Co-authored-by: Tim McCormack <tmccormack@edx.org>
2021-02-10 07:37:27 -05:00