Commit Graph

77 Commits

Author SHA1 Message Date
Toby Lawrence
6704e17afd [TNL-5632] Optimize the single_thread view.
Firstly, we're now explicitly instructing the comments service to not
return thread responses/comments if the request isn't AJAX.  So, if you
load the URL for a single discussion thread in your browser, this would
be a non-AJAX call and we'll avoid loading the responses for the entire
thread behind-the-scenes.  Big win here for large threads.

Next, we removed a redundant "get threads" call which was also happening
behind-the-scenes.  This call was redundant as the front-end JS also
grabs the thread list when a topic is chosen, so we were making an
extranenous call for no benefit.  Poof, gone!

Finally, we added some caching of database queries that are required to
drive a lot of the permissions/cohorts machinery around discussion.
This will have a minimal effect but introduced a cleaner way to apply
general memoization at the per-request level which will let us further
cache things as we identify them as issues.
2016-10-18 13:11:30 -04:00
John Eskew
3614eb2800 Move xmodule_django app to openedx.core.djangoapps 2016-10-06 14:50:40 -04:00
cahrens
9d8611374f Silence expected IntegrityErrors.
TNL-5181
2016-08-09 21:44:39 -04:00
Eric Fischer
3ba09221c1 Add Logging for CohortMembership 2016-08-05 22:15:50 -04:00
Calen Pennington
bc20a37c2b Simplify how shards are selected in CI 2016-08-03 16:23:02 -04:00
Ned Batchelder
8b1978ba6c Fix unused-import errors 2016-08-03 12:44:41 -04:00
cahrens
c195e7eb72 There is no need to call save after add/remove. 2016-07-27 16:15:16 -04:00
John Eskew
0899871958 Merge pull request #11042 from edx/jeskew/xml_removal
Remove XML modulestore code from most tests.
2016-04-27 11:20:02 -04:00
cahrens
1cd54d5fb7 Rename "is_default_cohort" method. 2016-04-14 16:38:34 -04:00
John Eskew
91c94977d5 Unify usage of a single test mixed modulestore called:
TEST_DATA_MIXED_MODULESTORE
Remove these test mixed modulestores:
TEST_DATA_MIXED_TOY_MODULESTORE
TEST_DATA_MIXED_CLOSED_MODULESTORE
TEST_DATA_MIXED_GRADED_MODULESTORE
2016-04-12 11:53:51 -04:00
John Eskew
4221ca6f2a Use ToyCourseFactory instead of the XMLModuleStore-backed toy course. 2016-04-12 11:53:50 -04:00
cahrens
28d743e2c8 Allow the "Default Group" to be renamed.
TNL-4355
2016-04-08 19:10:41 -04:00
Ned Batchelder
2e1238b83e Remove unused imports 2016-04-08 11:23:05 -04:00
Ben Patterson
c504029b39 Create a third shard for lms unit tests.
This will leverage the nose attrib plugin to allow us
to break tests apart on our build system to run
in parallel on separate nodes.
2016-03-17 12:01:42 -04:00
cahrens
2f3e3a55bb Remove unused profile name.
The profile name requires escaping when displayed. Proactively removing since it is not being used. Also discovered some dead code.
2016-03-07 09:37:39 -05:00
Toby Lawrence
9654449302 Merge pull request #11465 from edx/perf/speed-up-courseware-tests
Switch to SharedModuleStoreTestCase in the 'courseware' app where possible.
2016-02-16 10:06:53 -05:00
Toby Lawrence
49d3a7d35d More quality fixes. 2016-02-16 07:58:33 -05:00
Toby Lawrence
ead2f0477b Quality fixes. 2016-02-15 21:18:53 -05:00
Ned Batchelder
432a40f035 Update post_cohort_management_fix to Django 1.8 2016-02-11 15:39:35 -05:00
Toby Lawrence
6a6ef0fd35 Fix some broken tests. 2016-02-08 14:13:36 -05:00
Ned Batchelder
43ac38aa87 Add autospec to all mocks 2015-12-09 09:44:22 -05:00
Eric Fischer
88a389652b CohortMembership Test Fixes
There are 3 main changes in this commit:
* CohortFactory now sets up memberships properly, so consuming tests do not
need to explicitly touch CourseUserGroup.users to add() users.
* test_get_cohort_sql_queries has been updated to 3 and 9 queries when using
and not using the cache, respectively. This is needed due to each operation
needing an extra queery to get the CourseUserGroup from the CohortMembership.
* Adding remove_user_from_cohort(), the counterpart to add_user_to_cohort().
This is also to keep tests from touching the users field directly, and keep
CohortMembership data in sync.
2015-12-02 15:03:52 -05:00
Eric Fischer
731d85f771 CohortMembership Transaction Fixes
An issue arose recently due to ATOMIC_REQUESTS being turned on by default. It
turns out that CohortMemberships had been somewhat relying on the old default
transaction handling in order to keep CohortMemberships and the underlying
CourseUserGroup.users values in-sync.

To fix this, I've made all updates to Cohortmemberships go through an
outer_atomic(read_committed=True) block. This, is conjunction with the already
present select_for_update(), will no longer allow 2 simultaneous requests to
modify objects in memory without sharing them. Only one process will be
touching a given CohortMembership at any given time, and all changes will be
immediately comitted to the database, where the other process will see them.

I've also included some changes to get_cohort(), add_user_to_cohort(), and
remove_user_from_cohort() in order to properly make use of the new
CohortMembership system.
2015-12-02 15:03:28 -05:00
Ned Batchelder
f5d0f3ff55 Remove useless pylint suppressions 2015-11-22 07:41:19 -05:00
Usman Khalid
6cb62f2697 Rebase upgrade Django to v1.8.5
Please note that this is a squshed commit and the work of:
Symbolist, macdiesel, nedbat, doctoryes, muzaffaryousaf and muhammad-ammar
2015-11-10 15:00:19 -05:00
Eric Fischer
3609cc7a99 Post-migration management command
On devops recommendation, now handling the potential for an 'inconsistency
window' via a management command instead of a hacky "re-run the data migration"
bash script.
2015-11-03 10:30:43 -05:00
Eric Fischer
dbbc64ff88 CohortMembership Race Condition Test
By using the before_after library, we can force a race condition to reliably
occur in the CohortMembership.save() method. This unit test will do just that,
and ensure that our race-condition-handling code functions as it should.
2015-10-30 11:07:25 -04:00
Eric Fischer
08ed3b547f CohortMemberships Unit Test Updates
Updating previously-existing unit tests to function with the new
CohortMembership model.
2015-10-30 11:07:25 -04:00
Eric Fischer
83163e58f8 CohortMemberships Code Changes
The code changes needed to get CohortMembership functioning properly.

The key of this change is twofold: first, CohortMemberships are unique
per-user, per-course. This is enforced at the database level. Secondly,
the updates are done using a select_for_update, which ensures atomicity.
2015-10-30 11:07:25 -04:00
Eric Fischer
56d49e7390 CohortMemberships Migrations
These are the migrations needed for CohortMembership to function.
0005 establishes the table, 0006 will be used to move existing data
into the table as needed.

Per product guidance, we can just arbitrarily reassign problem users.
Implementing that decision, as well as the remainder of the data migration.

Also including a short script to re-run the 0006 migration after code changes
are live, to prevent a potential issue where the database become out-of-sync.
2015-10-30 11:07:25 -04:00
Ned Batchelder
322ca34b20 Remove pylint pragmas from "class Meta"
Also remove useless docstrings where they were added to keep pylint
quiet.
2015-10-21 07:37:00 -04:00
Matt Drayer
1eab25f292 mattdrayer/increment-edx-lint: Bump to v0.2.9 and address pylint/pep8 violations
* Fix paver violations to stablize edx-lint update
* Parens, Line2Long
* Fix missing docstrings
* Fix PEP8 issues
* Address PR feedback (thanks @nedbat!)
2015-10-19 10:11:59 -04:00
muhammad-ammar
6a5ce5d544 Upgrade factory_boy
TNL-3179
2015-09-18 18:02:38 +05:00
zubair-arbi
ec28a75f14 In-course reverification access control
* Automatically create user partitions on course publish for each ICRV checkpoint.
* Disable partitions for ICRV checkpoints that have been deleted.
* Skip partitions that have been disabled when checking access.
* Add verification access control UI to visibility settings.
* Add verification access control UI to sequential and vertical settings.
* Add partition scheme for verification partition groups.
* Cache information used by verification partition scheme and invalidate the cache on update.
* Add location parameter to UserPartition so the partition scheme can find the associated checkpoint.
* Refactor GroupConfiguration to allow multiple user partitions.
* Add special messaging to ICRV for students in the honor track.

Authors: Zubair Arbi, Awais Qureshi, Aamir Khan, Will Daly
2015-08-20 08:43:55 -07:00
Ned Batchelder
f54fe787c6 Remove needless 'disable=no-member' pragmas 2015-08-03 17:47:44 -04:00
Ben McMorran
4a78271851 Move is_commentable_cohorted to django_comment_client 2015-07-30 20:59:34 +00:00
Braden MacDonald
0defc55b84 Allow previewing cohorted content when masquerading 2015-07-22 00:54:15 -07:00
Sarina Canelake
22bbdacee9 Convert Meta classes to new-style classes 2015-07-13 17:33:26 -04:00
Sarina Canelake
ba8fd1c21d Eliminate instances of unused-import Pylint violation 2015-07-13 17:33:25 -04:00
Kevin Luo
718c21cfc8 Improve cohort test
Remove SQLite version dependent error string check
2015-06-17 16:06:10 -07:00
Sarina Canelake
e53b9c83d9 Use Django 1.4 @ensure_csrf_cookie method PLAT-664 2015-06-06 08:48:36 -04:00
Diana Huang
dae137feaa Convert all tabs to the new plugin framework. 2015-06-02 15:05:16 -04:00
Greg Price
7ce579c274 Add group fields to thread list endpoint 2015-05-11 15:59:35 -04:00
Ned Batchelder
777be12ada Add missing __init__.py files 2015-04-30 07:43:08 -04:00
Christina Roberts
3f07660d27 Merge pull request #7454 from edx/andya/user-api-transaction-handling
Clean up transactional behavior in User API
2015-03-25 15:08:21 -04:00
Andy Armstrong
a9dce7c331 Clean up transactional behavior in User API 2015-03-25 13:44:03 -04:00
Sarina Canelake
c6ab15c64c Merge pull request #7352 from edx/sarina/pep8-quality-report
Improve pep8 reporting
2015-03-23 21:10:58 -04:00
Sarina Canelake
e77211b713 Run pep8 on all files, and fix uncovered errors 2015-03-23 15:50:29 -04:00
Ned Batchelder
a84735057d Move common/lib/*.py to openedx/core/lib
This makes these files importable, and puts them into the new best guess
as to where files should live.
2015-03-23 12:40:24 -04:00
Usman Khalid
c50f828187 Fixes after rebase. 2015-03-23 19:03:31 +05:00