Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
de3889f5
Commit
de3889f5
authored
Aug 10, 2015
by
Jonathan Piacenti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Quality cleanup.
parent
cf3e37bb
Hide whitespace changes
Inline
Side-by-side
Showing
36 changed files
with
43 additions
and
123 deletions
+43
-123
cms/djangoapps/contentstore/views/helpers.py
+0
-1
cms/djangoapps/contentstore/views/preview.py
+0
-2
cms/djangoapps/contentstore/views/tests/test_course_updates.py
+0
-1
common/djangoapps/student/roles.py
+0
-9
common/lib/xmodule/xmodule/tests/test_services.py
+0
-5
common/lib/xmodule/xmodule/x_module.py
+2
-2
lms/djangoapps/api_manager/management/commands/tests/test_migrate_courseids.py
+0
-4
lms/djangoapps/api_manager/management/commands/tests/test_migrate_stage_prefix.py
+1
-13
lms/djangoapps/api_manager/users/tests.py
+0
-9
lms/djangoapps/courseware/tests/test_submitting_problems.py
+1
-1
lms/djangoapps/courseware/testutils.py
+1
-0
lms/djangoapps/django_comment_client/base/tests.py
+5
-4
lms/djangoapps/django_comment_client/base/views.py
+0
-1
lms/djangoapps/django_comment_client/forum/views.py
+5
-10
lms/djangoapps/django_comment_client/utils.py
+0
-1
lms/djangoapps/gradebook/management/commands/migrate_gradebook_courseids_v2.py
+1
-1
lms/djangoapps/gradebook/management/commands/tests/test_generate_gradebook_entries.py
+0
-1
lms/djangoapps/gradebook/management/commands/tests/test_migrate_gradebook_courseids_v2.py
+1
-6
lms/djangoapps/gradebook/models.py
+4
-2
lms/djangoapps/instructor/tests/test_receivers.py
+0
-1
lms/djangoapps/organizations/tests.py
+1
-2
lms/djangoapps/organizations/views.py
+1
-1
lms/djangoapps/progress/models.py
+0
-6
lms/djangoapps/projects/management/commands/migrate_project_courseids.py
+2
-2
lms/djangoapps/projects/management/commands/tests/test_migrate_project_courseids.py
+1
-7
lms/djangoapps/projects/management/commands/tests/test_migrate_project_courseids_v2.py
+0
-6
lms/djangoapps/projects/tests/test_peer_reviews.py
+1
-2
lms/djangoapps/projects/tests/test_projects.py
+1
-0
lms/djangoapps/projects/tests/test_receivers.py
+1
-3
lms/djangoapps/projects/tests/test_submission_reviews.py
+1
-2
lms/djangoapps/projects/tests/test_workgroup_reviews.py
+1
-2
lms/djangoapps/projects/tests/test_workgroup_submissions.py
+1
-0
lms/djangoapps/projects/tests/test_workgroups.py
+4
-4
lms/djangoapps/projects/views.py
+2
-4
lms/djangoapps/social_engagement/management/commands/tests/tests.py
+2
-5
lms/static/sass/course/instructor/_instructor_2.scss
+3
-3
No files found.
cms/djangoapps/contentstore/views/helpers.py
View file @
de3889f5
...
...
@@ -12,7 +12,6 @@ from django.http import HttpResponse
from
django.shortcuts
import
redirect
from
django.utils.translation
import
ugettext
as
_
from
edxmako
import
add_lookup
from
edxmako.shortcuts
import
render_to_string
,
render_to_response
from
opaque_keys.edx.keys
import
UsageKey
from
xblock.core
import
XBlock
...
...
cms/djangoapps/contentstore/views/preview.py
View file @
de3889f5
...
...
@@ -15,11 +15,9 @@ from xmodule.contentstore.django import contentstore
from
xmodule.error_module
import
ErrorDescriptor
from
xmodule.exceptions
import
NotFoundError
,
ProcessingError
from
xmodule.library_tools
import
LibraryToolsService
from
xmodule.services
import
SettingsService
from
xmodule.modulestore.django
import
modulestore
,
ModuleI18nService
from
xmodule.mixin
import
wrap_with_license
from
opaque_keys.edx.keys
import
UsageKey
from
opaque_keys.edx.locator
import
LibraryUsageLocator
from
xmodule.x_module
import
ModuleSystem
from
xblock.runtime
import
KvsFieldData
from
xblock.django.request
import
webob_to_django_response
,
django_to_webob_request
...
...
cms/djangoapps/contentstore/views/tests/test_course_updates.py
View file @
de3889f5
...
...
@@ -2,7 +2,6 @@
unit tests for course_info views and models.
"""
import
json
from
mock
import
patch
from
django.test.utils
import
override_settings
from
contentstore.models
import
PushNotificationConfig
...
...
common/djangoapps/student/roles.py
View file @
de3889f5
...
...
@@ -257,15 +257,6 @@ class CourseObserverRole(CourseRole):
@register_access_role
class
CourseObserverRole
(
CourseRole
):
"""A course Observer"""
ROLE
=
'observer'
def
__init__
(
self
,
*
args
,
**
kwargs
):
super
(
CourseObserverRole
,
self
)
.
__init__
(
self
.
ROLE
,
*
args
,
**
kwargs
)
@register_access_role
class
CourseBetaTesterRole
(
CourseRole
):
"""A course Beta Tester"""
ROLE
=
'beta_testers'
...
...
common/lib/xmodule/xmodule/tests/test_services.py
View file @
de3889f5
...
...
@@ -10,13 +10,8 @@ from django.conf import settings
from
django.test.utils
import
override_settings
from
xblock.runtime
import
Mixologist
from
xmodule.services
import
SettingsService
from
xmodule.services
import
SettingsService
,
NotificationsService
from
edx_notifications.data
import
(
NotificationType
)
class
_DummyBlock
(
object
):
""" Dummy Xblock class """
...
...
common/lib/xmodule/xmodule/x_module.py
View file @
de3889f5
...
...
@@ -1629,7 +1629,7 @@ class DiscussionService(object):
cohorts
=
get_course_cohorts
(
course_id
)
cohorted_commentables
=
get_cohorted_commentables
(
course_id
)
course_settings
=
make_course_settings
(
course
)
course_settings
=
make_course_settings
(
course
,
user
)
context
=
{
'user'
:
user
,
...
...
@@ -1675,7 +1675,7 @@ class DiscussionService(object):
user
=
self
.
runtime
.
user
course
=
get_course_with_access
(
user
,
'load_forum'
,
course_id
)
category_map
=
get_discussion_category_map
(
course
)
category_map
=
get_discussion_category_map
(
course
,
user
)
is_moderator
=
has_permission
(
user
,
"see_all_cohorts"
,
course_id
)
flag_moderator
=
has_permission
(
user
,
'openclose_thread'
,
course_id
)
or
\
...
...
lms/djangoapps/api_manager/management/commands/tests/test_migrate_courseids.py
View file @
de3889f5
...
...
@@ -16,7 +16,6 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase, mixed_st
from
xmodule.modulestore.tests.factories
import
CourseFactory
,
ItemFactory
MODULESTORE_CONFIG
=
mixed_store_config
(
settings
.
COMMON_TEST_DATA_ROOT
,
{},
include_xml
=
False
)
from
django.db
import
connection
@override_settings
(
MODULESTORE
=
MODULESTORE_CONFIG
)
class
MigrateCourseIdsTests
(
ModuleStoreTestCase
):
...
...
@@ -61,7 +60,6 @@ class MigrateCourseIdsTests(ModuleStoreTestCase):
self
.
new_style_course_id2
=
unicode
(
self
.
course2
.
id
)
self
.
new_style_content_id2
=
unicode
(
self
.
chapter2
.
location
)
def
test_migrate_courseids
(
self
):
"""
Test the data migration
...
...
@@ -81,11 +79,9 @@ class MigrateCourseIdsTests(ModuleStoreTestCase):
course_content_group2
=
api_models
.
CourseContentGroupRelationship
.
objects
.
create
(
course_id
=
self
.
new_style_course_id2
,
content_id
=
self
.
new_style_content_id2
,
group_profile
=
group_profile2
)
course_module_completion2
=
CourseModuleCompletion
.
objects
.
create
(
user
=
user2
,
course_id
=
self
.
new_style_course_id2
,
content_id
=
self
.
new_style_content_id2
)
# Run the data migration
migrate_courseids
.
Command
()
.
handle
()
# Confirm that the data has been properly migrated
updated_course_group
=
api_models
.
CourseGroupRelationship
.
objects
.
get
(
id
=
course_group
.
id
)
self
.
assertEqual
(
updated_course_group
.
course_id
,
self
.
new_style_course_id
)
...
...
lms/djangoapps/api_manager/management/commands/tests/test_migrate_stage_prefix.py
View file @
de3889f5
...
...
@@ -3,23 +3,13 @@ Run these tests @ Devstack:
rake fasttest_lms[common/djangoapps/api_manager/management/commands/tests/test_migrate_orgdata.py]
"""
from
django.contrib.auth.models
import
User
from
progress.models
import
CourseModuleCompletion
from
api_manager.management.commands
import
migrate_stage_prefix
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
django.conf
import
settings
from
django.contrib.auth.models
import
Group
,
User
from
django.test
import
TestCase
from
django.contrib.auth.models
import
User
from
django.test.utils
import
override_settings
from
progress.models
import
CourseModuleCompletion
from
api_manager.management.commands
import
migrate_stage_prefix
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
,
mixed_store_config
from
xmodule.modulestore.tests.factories
import
CourseFactory
,
ItemFactory
from
django.db
import
connection
MODULESTORE_CONFIG
=
mixed_store_config
(
settings
.
COMMON_TEST_DATA_ROOT
,
{},
include_xml
=
False
)
...
...
@@ -53,11 +43,9 @@ class MigrateCourseIdsTests(ModuleStoreTestCase):
user2
=
User
.
objects
.
create
(
email
=
'testuser2@edx.org'
,
username
=
'testuser2'
,
password
=
'testpassword2'
,
is_active
=
True
)
course_module_completion2
=
CourseModuleCompletion
.
objects
.
create
(
user
=
user2
,
course_id
=
self
.
good_style_course_id2
,
content_id
=
self
.
good_style_content_id2
,
stage
=
self
.
bad_style_stage2
)
# Run the data migration
migrate_stage_prefix
.
Command
()
.
handle
()
updated_course_module_completion
=
CourseModuleCompletion
.
objects
.
get
(
id
=
course_module_completion
.
id
)
self
.
assertEqual
(
updated_course_module_completion
.
stage
,
self
.
good_style_stage
)
...
...
lms/djangoapps/api_manager/users/tests.py
View file @
de3889f5
...
...
@@ -17,7 +17,6 @@ from edx_notifications.lib.publisher import register_notification_type, publish_
import
mock
from
django.conf
import
settings
from
django.contrib.auth.models
import
User
from
django.core.cache
import
cache
from
django.core.exceptions
import
ObjectDoesNotExist
from
django.test
import
Client
...
...
@@ -28,23 +27,15 @@ from django.utils.translation import ugettext as _
from
capa.tests.response_xml_factory
import
StringResponseXMLFactory
from
courseware
import
module_render
from
courseware.model_data
import
FieldDataCache
from
courseware.tests.factories
import
StudentModuleFactory
from
django_comment_common.models
import
Role
,
FORUM_ROLE_MODERATOR
from
instructor.access
import
allow_access
from
notification_prefs
import
NOTIFICATION_PREF_KEY
from
projects.models
import
Project
,
Workgroup
from
student.tests.factories
import
UserFactory
from
student.models
import
anonymous_id_for_user
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
openedx.core.djangoapps.user_api.models
import
UserPreference
from
xmodule.modulestore.tests.factories
import
CourseFactory
,
ItemFactory
from
django.contrib.auth.models
import
User
from
openedx.core.djangoapps.user_api.models
import
UserPreference
from
openedx.core.djangoapps.user_api.models
import
UserPreference
from
xmodule.modulestore.tests.factories
import
CourseFactory
,
ItemFactory
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
,
mixed_store_config
from
xmodule.modulestore
import
Location
from
django.contrib.auth.models
import
User
from
notification_prefs
import
NOTIFICATION_PREF_KEY
...
...
lms/djangoapps/courseware/tests/test_submitting_problems.py
View file @
de3889f5
...
...
@@ -439,7 +439,7 @@ class TestCourseGrader(TestSubmittingProblems):
student_module
=
StudentModule
.
objects
.
get
(
course_id
=
self
.
course
.
id
,
student
=
self
.
student_user
,
module_state_key
=
self
.
problem_location
(
'p1'
)
module_state_key
=
self
.
problem_location
(
'p1'
)
,
)
# count how many state history entries there are
baseline
=
StudentModuleHistory
.
objects
.
filter
(
...
...
lms/djangoapps/courseware/testutils.py
View file @
de3889f5
...
...
@@ -131,6 +131,7 @@ class RenderXBlockTestMixin(object):
# (3) get_item for HTML block in get_module_by_usage_id
# (4) get_parent when loading HTML block
# (5) edx_notes descriptor call to get_course
# (6) get_course in handle_progress_event
# Split:
# (1) course_index - bulk_operation call
# (2) structure - get_course_with_access
...
...
lms/djangoapps/django_comment_client/base/tests.py
View file @
de3889f5
...
...
@@ -9,10 +9,11 @@ from mock import patch, ANY, Mock
from
nose.tools
import
assert_true
,
assert_equal
# pylint: disable=no-name-in-module
from
opaque_keys.edx.locations
import
SlashSeparatedCourseKey
from
lms.lib.comment_client
import
Thread
from
lms
import
startup
from
django_comment_client.base
import
views
from
django_comment_client.tests.group_id
import
CohortedTopicGroupIdTestMixin
,
NonCohortedTopicGroupIdTestMixin
,
GroupIdAssertionMixin
from
django_comment_client.tests.group_id
import
(
CohortedTopicGroupIdTestMixin
,
NonCohortedTopicGroupIdTestMixin
,
GroupIdAssertionMixin
)
from
django_comment_client.tests.utils
import
CohortedContentTestCase
from
django_comment_client.tests.unicode
import
UnicodeTestMixin
from
django_comment_common.models
import
Role
...
...
@@ -24,8 +25,8 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from
openedx.core.djangoapps.course_groups.cohorts
import
is_commentable_cohorted
,
add_cohort
,
add_user_to_cohort
from
edx_notifications.lib.consumer
import
get_notifications_
for_user
,
get_notifications_
count_for_user
from
edx_notifications.startup
import
initialize
as
initialize_notifications
from
edx_notifications.lib.consumer
import
get_notifications_count_for_user
from
edx_notifications.startup
import
initialize
as
initialize_notifications
from
social_engagement.models
import
StudentSocialEngagementScore
...
...
lms/djangoapps/django_comment_client/base/views.py
View file @
de3889f5
...
...
@@ -8,7 +8,6 @@ from django.conf import settings
from
django.contrib.auth.decorators
import
login_required
from
django.contrib.auth.models
import
User
from
django.core
import
exceptions
from
django.core.files.storage
import
get_storage_class
from
django.http
import
Http404
,
HttpResponseBadRequest
from
django.utils.translation
import
ugettext
as
_
from
django.views.decorators
import
csrf
...
...
lms/djangoapps/django_comment_client/forum/views.py
View file @
de3889f5
...
...
@@ -36,10 +36,6 @@ from ccx.overrides import get_current_ccx
from
django_comment_client.permissions
import
has_permission
from
django_comment_client.utils
import
(
merge_dict
,
extract
,
strip_none
,
add_courseware_context
,
get_group_id_for_comments_service
)
...
...
@@ -144,14 +140,13 @@ def get_threads(request, course, discussion_id=None, per_page=THREADS_PER_PAGE):
#if the user requested a group explicitly, give them that group, otherwise, if mod, show all, else if student, use cohort
group_id
=
request
.
GET
.
get
(
'group_id'
)
is_cohorted
=
is_commentable_cohorted
(
course
.
id
,
discussion_id
)
if
group_id
in
(
"all"
,
"None"
):
group_id
=
None
if
not
has_permission
(
request
.
user
,
"see_all_cohorts"
,
course
.
id
)
:
if
has_permission
(
request
.
user
,
"see_all_cohorts"
,
course
.
id
):
group_id
=
request
.
GET
.
get
(
'group_id'
)
if
group_id
in
(
"all"
,
"None"
):
group_id
=
None
else
:
group_id
=
get_cohort_id
(
request
.
user
,
course
.
id
)
if
not
group_id
and
get_cohorted_threads_privacy
(
course
.
id
)
==
'cohort-only'
:
default_query_params
[
'exclude_groups'
]
=
True
...
...
lms/djangoapps/django_comment_client/utils.py
View file @
de3889f5
...
...
@@ -452,7 +452,6 @@ def add_courseware_context(content_list, course, user, id_map=None):
id_map
=
get_discussion_id_map
(
course
,
user
)
for
content
in
content_list
:
print
content
commentable_id
=
content
[
'commentable_id'
]
if
commentable_id
in
id_map
:
location
=
id_map
[
commentable_id
][
"location"
]
.
to_deprecated_string
()
...
...
lms/djangoapps/gradebook/management/commands/migrate_gradebook_courseids_v2.py
View file @
de3889f5
...
...
@@ -20,7 +20,7 @@ def _migrate_course_id(old_course_id):
def
_migrate_content_id
(
old_content_id
):
if
"slashes:"
in
old_content_id
or
"course-v1:"
in
old_content_id
:
new_content_id
=
self
.
_migrate_course_id
(
old_content_id
)
new_content_id
=
_migrate_course_id
(
old_content_id
)
else
:
content_id
=
old_content_id
.
replace
(
"location:"
,
""
)
content_components
=
content_id
.
split
(
'+'
)
...
...
lms/djangoapps/gradebook/management/commands/tests/test_generate_gradebook_entries.py
View file @
de3889f5
...
...
@@ -5,7 +5,6 @@ Run these tests @ Devstack:
from
datetime
import
datetime
from
django.test.utils
import
override_settings
from
mock
import
MagicMock
,
patch
from
unittest
import
skip
import
uuid
from
django.conf
import
settings
...
...
lms/djangoapps/gradebook/management/commands/tests/test_migrate_gradebook_courseids_v2.py
View file @
de3889f5
...
...
@@ -2,8 +2,6 @@
Run these tests @ Devstack:
rake fasttest_lms[common/djangoapps/api_manager/management/commands/tests/test_migrate_orgdata.py]
"""
from
datetime
import
datetime
import
uuid
from
django.contrib.auth.models
import
User
from
django.conf
import
settings
...
...
@@ -12,7 +10,6 @@ from django.test.utils import override_settings
from
gradebook
import
models
as
gradebook_models
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
,
mixed_store_config
from
gradebook.management.commands
import
migrate_gradebook_courseids_v2
from
xmodule.modulestore.tests.factories
import
CourseFactory
,
ItemFactory
MODULESTORE_CONFIG
=
mixed_store_config
(
settings
.
COMMON_TEST_DATA_ROOT
,
{},
include_xml
=
False
)
...
...
@@ -25,7 +22,7 @@ class MigrateCourseIdsTests(ModuleStoreTestCase):
"""
def
setUp
(
self
):
super
(
MigrateCourseIdsTests
,
self
)
.
setUp
()
self
.
bad_style_course_id
=
"slashes:old+style+id"
self
.
good_style_course_id
=
"old/style/id"
self
.
bad_style_content_id
=
"location:old+style+id+chapter+1234567890"
...
...
@@ -47,11 +44,9 @@ class MigrateCourseIdsTests(ModuleStoreTestCase):
user2
=
User
.
objects
.
create
(
email
=
'testuser2@edx.org'
,
username
=
'testuser2'
,
password
=
'testpassword2'
,
is_active
=
True
)
gradebook_entry2
=
gradebook_models
.
StudentGradebook
.
objects
.
create
(
user
=
user2
,
course_id
=
self
.
bad_style_course_id2
,
grade
=
0.95
,
proforma_grade
=
0.64
)
# Run the data migration
migrate_gradebook_courseids_v2
.
Command
()
.
handle
()
# Confirm that the data has been properly migrated
updated_gradebook_entries
=
gradebook_models
.
StudentGradebook
.
objects
.
get
(
id
=
gradebook_entry
.
id
)
updated_gradebook_entry
=
gradebook_models
.
StudentGradebook
.
objects
.
get
(
id
=
gradebook_entry2
.
id
)
...
...
lms/djangoapps/gradebook/models.py
View file @
de3889f5
...
...
@@ -30,7 +30,7 @@ class StudentGradebook(TimeStampedModel):
unique_together
=
((
'user'
,
'course_id'
),)
@classmethod
def
generate_leaderboard
(
cls
,
course_key
,
user_id
=
None
,
count
=
3
,
exclude_users
=
[]
):
def
generate_leaderboard
(
cls
,
course_key
,
user_id
=
None
,
count
=
3
,
exclude_users
=
None
):
"""
Assembles a data set representing the Top N users, by grade, for a given course.
Optionally provide a user_id to include user-specific info. For example, you
...
...
@@ -55,6 +55,7 @@ class StudentGradebook(TimeStampedModel):
those users who currently lack gradebook entries. We assume zero grades for these users because they
have not yet submitted a response to a scored assessment which means no grade has been calculated.
"""
exclude_users
=
exclude_users
or
[]
data
=
{}
data
[
'course_avg'
]
=
0
data
[
'course_max'
]
=
0
...
...
@@ -109,10 +110,11 @@ class StudentGradebook(TimeStampedModel):
return
data
@classmethod
def
get_user_position
(
cls
,
course_key
,
user_id
,
queryset
=
None
,
exclude_users
=
[]
):
def
get_user_position
(
cls
,
course_key
,
user_id
,
queryset
=
None
,
exclude_users
=
None
):
"""
Helper method to return the user's position in the leaderboard for Proficiency
"""
exclude_users
=
exclude_users
or
[]
data
=
{
'user_position'
:
0
,
'user_grade'
:
0
}
user_grade
=
0
users_above
=
0
...
...
lms/djangoapps/instructor/tests/test_receivers.py
View file @
de3889f5
...
...
@@ -7,7 +7,6 @@ from datetime import datetime
import
uuid
from
django.conf
import
settings
from
django.contrib.auth.models
import
User
from
django.test.utils
import
override_settings
from
xmodule.modulestore.tests.factories
import
CourseFactory
,
ItemFactory
...
...
lms/djangoapps/organizations/tests.py
View file @
de3889f5
...
...
@@ -22,9 +22,9 @@ from student.tests.factories import CourseEnrollmentFactory, UserFactory
from
xmodule.modulestore.tests.factories
import
CourseFactory
TEST_API_KEY
=
str
(
uuid
.
uuid4
())
TEST_API_KEY
=
str
(
uuid
.
uuid4
())
MODULESTORE_CONFIG
=
mixed_store_config
(
settings
.
COMMON_TEST_DATA_ROOT
,
{},
include_xml
=
False
)
class
SecureClient
(
Client
):
""" Django test client using a "secure" connection. """
...
...
@@ -502,7 +502,6 @@ class OrganizationsApiTests(ModuleStoreTestCase):
self
.
assertEqual
(
response
.
data
[
'users_grade_complete_count'
],
8
)
self
.
assertEqual
(
response
.
data
[
'users_grade_average'
],
0.504
)
courses
=
{
'courses'
:
unicode
(
course1
.
id
)}
filtered_metrics_uri
=
'{}?{}'
.
format
(
metrics_uri
,
urlencode
(
courses
))
response
=
self
.
do_get
(
filtered_metrics_uri
)
...
...
lms/djangoapps/organizations/views.py
View file @
de3889f5
...
...
@@ -12,7 +12,7 @@ from rest_framework.response import Response
from
api_manager.courseware_access
import
get_course_key
from
organizations.models
import
Organization
from
api_manager.users.serializers
import
UserSerializer
,
SimpleUserSerializer
from
api_manager.users.serializers
import
SimpleUserSerializer
from
api_manager.groups.serializers
import
GroupSerializer
from
api_manager.utils
import
str2bool
from
gradebook.models
import
StudentGradebook
...
...
lms/djangoapps/progress/models.py
View file @
de3889f5
...
...
@@ -2,19 +2,13 @@
Django database models supporting the progress app
"""
from
datetime
import
datetime
from
django.conf
import
settings
from
django.contrib.auth.models
import
User
from
django.db
import
models
from
django.db.models
import
Sum
,
Q
from
django.utils.timezone
import
UTC
from
model_utils.models
import
TimeStampedModel
from
xmodule_django.models
import
CourseKeyField
from
xmodule.modulestore.django
import
modulestore
from
opaque_keys.edx.keys
import
CourseKey
class
StudentProgress
(
TimeStampedModel
):
...
...
lms/djangoapps/projects/management/commands/migrate_project_courseids.py
View file @
de3889f5
...
...
@@ -7,7 +7,7 @@ from django.contrib.auth.models import User
from
django.core.management.base
import
BaseCommand
from
django.test
import
RequestFactory
from
api_manager.courseware_access
import
get_course
,
get_course_child
from
api_manager.courseware_access
import
get_course
from
opaque_keys
import
InvalidKeyError
from
projects.models
import
Project
,
WorkgroupReview
,
WorkgroupSubmissionReview
...
...
@@ -25,7 +25,7 @@ class Command(BaseCommand):
projects
=
Project
.
objects
.
all
()
for
project
in
projects
:
course_descriptor
,
course_key
,
course_content
=
get_course
(
request
,
request
.
user
,
project
.
course_id
)
_course_descriptor
,
course_key
,
_
course_content
=
get_course
(
request
,
request
.
user
,
project
.
course_id
)
project
.
course_id
=
unicode
(
course_key
)
try
:
project
.
content_id
=
course_key
.
make_usage_key_from_deprecated_string
(
project
.
content_id
)
...
...
lms/djangoapps/projects/management/commands/tests/test_migrate_project_courseids.py
View file @
de3889f5
...
...
@@ -6,8 +6,7 @@ from datetime import datetime
import
uuid
from
django.conf
import
settings
from
django.contrib.auth.models
import
Group
,
User
from
django.test
import
TestCase
from
django.contrib.auth.models
import
User
from
django.test.utils
import
override_settings
from
projects.management.commands
import
migrate_project_courseids
...
...
@@ -15,8 +14,6 @@ from projects.models import Project, Workgroup, WorkgroupReview, WorkgroupSubmis
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
,
mixed_store_config
from
xmodule.modulestore.tests.factories
import
CourseFactory
,
ItemFactory
from
django.db
import
connection
MODULESTORE_CONFIG
=
mixed_store_config
(
settings
.
COMMON_TEST_DATA_ROOT
,
{},
include_xml
=
False
)
...
...
@@ -63,7 +60,6 @@ class MigrateCourseIdsTests(ModuleStoreTestCase):
self
.
new_style_course_id2
=
unicode
(
self
.
course2
.
id
)
self
.
new_style_content_id2
=
unicode
(
self
.
chapter2
.
location
)
def
test_migrate_project_courseids
(
self
):
"""
Test the data migration
...
...
@@ -83,11 +79,9 @@ class MigrateCourseIdsTests(ModuleStoreTestCase):
workgroup_submission2
=
WorkgroupSubmission
.
objects
.
create
(
workgroup
=
workgroup2
,
user
=
user2
)
workgroup_submission_review2
=
WorkgroupSubmissionReview
.
objects
.
create
(
submission
=
workgroup_submission2
,
content_id
=
self
.
new_style_content_id2
)
# Run the data migration
migrate_project_courseids
.
Command
()
.
handle
()
# Confirm that the data has been properly migrated
updated_project
=
Project
.
objects
.
get
(
id
=
project
.
id
)
self
.
assertEqual
(
updated_project
.
course_id
,
self
.
new_style_course_id
)
...
...
lms/djangoapps/projects/management/commands/tests/test_migrate_project_courseids_v2.py
View file @
de3889f5
...
...
@@ -2,12 +2,8 @@
Run these tests @ Devstack:
rake fasttest_lms[common/djangoapps/api_manager/management/commands/tests/test_migrate_orgdata.py]
"""
from
datetime
import
datetime
import
uuid
from
django.conf
import
settings
from
django.contrib.auth.models
import
Group
,
User
from
django.test
import
TestCase
from
django.test.utils
import
override_settings
from
django.contrib.auth.models
import
User
...
...
@@ -60,11 +56,9 @@ class MigrateCourseIdsTests(ModuleStoreTestCase):
workgroup_submission2
=
WorkgroupSubmission
.
objects
.
create
(
workgroup
=
workgroup2
,
user
=
user2
)
workgroup_submission_review2
=
WorkgroupSubmissionReview
.
objects
.
create
(
submission
=
workgroup_submission2
,
content_id
=
self
.
bad_style_content_id2
)
# Run the data migration
migrate_project_courseids_v2
.
Command
()
.
handle
()
# Confirm that the data has been properly migrated
updated_project
=
Project
.
objects
.
get
(
id
=
project
.
id
)
self
.
assertEqual
(
updated_project
.
course_id
,
self
.
good_style_course_id
)
...
...
lms/djangoapps/projects/tests/test_peer_reviews.py
View file @
de3889f5
...
...
@@ -15,9 +15,8 @@ from django.test.utils import override_settings
from
projects.models
import
Project
,
Workgroup
from
student.models
import
anonymous_id_for_user
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
xmodule.modulestore.tests.factories
import
CourseFactory
,
ItemFactory
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
,
mixed_store_config
from
xmodule.modulestore.tests.factories
import
CourseFactory
,
ItemFactory
TEST_API_KEY
=
str
(
uuid
.
uuid4
())
MODULESTORE_CONFIG
=
mixed_store_config
(
settings
.
COMMON_TEST_DATA_ROOT
,
{},
include_xml
=
False
)
...
...
lms/djangoapps/projects/tests/test_projects.py
View file @
de3889f5
...
...
@@ -34,6 +34,7 @@ class ProjectsApiTests(TestCase):
""" Test suite for Users API views """
def
setUp
(
self
):
super
(
ProjectsApiTests
,
self
)
.
setUp
()
self
.
test_server_prefix
=
'https://testserver'
self
.
test_projects_uri
=
'/api/server/projects/'
self
.
test_organizations_uri
=
'/api/server/organizations/'
...
...
lms/djangoapps/projects/tests/test_receivers.py
View file @
de3889f5
...
...
@@ -7,12 +7,10 @@ from datetime import datetime
import
uuid
from
django.conf
import
settings
from
django.contrib.auth.models
import
User
from
django.test.utils
import
override_settings
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
,
mixed_store_config
from
xmodule.modulestore.tests.factories
import
CourseFactory
,
ItemFactory
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
,
mixed_store_config
from
util.signals
import
course_deleted
from
projects
import
models
...
...
lms/djangoapps/projects/tests/test_submission_reviews.py
View file @
de3889f5
...
...
@@ -15,9 +15,8 @@ from django.test.utils import override_settings
from
projects.models
import
Project
,
Workgroup
,
WorkgroupSubmission
from
student.models
import
anonymous_id_for_user
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
xmodule.modulestore.tests.factories
import
CourseFactory
,
ItemFactory
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
,
mixed_store_config
from
xmodule.modulestore.tests.factories
import
CourseFactory
,
ItemFactory
MODULESTORE_CONFIG
=
mixed_store_config
(
settings
.
COMMON_TEST_DATA_ROOT
,
{},
include_xml
=
False
)
TEST_API_KEY
=
str
(
uuid
.
uuid4
())
...
...
lms/djangoapps/projects/tests/test_workgroup_reviews.py
View file @
de3889f5
...
...
@@ -15,9 +15,8 @@ from django.test.utils import override_settings
from
projects.models
import
Project
,
Workgroup
,
WorkgroupSubmission
from
student.models
import
anonymous_id_for_user
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
xmodule.modulestore.tests.factories
import
CourseFactory
,
ItemFactory
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
,
mixed_store_config
from
xmodule.modulestore.tests.factories
import
CourseFactory
,
ItemFactory
MODULESTORE_CONFIG
=
mixed_store_config
(
settings
.
COMMON_TEST_DATA_ROOT
,
{},
include_xml
=
False
)
TEST_API_KEY
=
str
(
uuid
.
uuid4
())
...
...
lms/djangoapps/projects/tests/test_workgroup_submissions.py
View file @
de3889f5
...
...
@@ -33,6 +33,7 @@ class SubmissionsApiTests(TestCase):
""" Test suite for Users API views """
def
setUp
(
self
):
super
(
SubmissionsApiTests
,
self
)
.
setUp
()
self
.
test_server_prefix
=
'https://testserver'
self
.
test_users_uri
=
'/api/server/users/'
self
.
test_workgroups_uri
=
'/api/server/workgroups/'
...
...
lms/djangoapps/projects/tests/test_workgroups.py
View file @
de3889f5
...
...
@@ -20,9 +20,10 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase, mixed_st
from
projects.models
import
Project
,
Workgroup
from
student.tests.factories
import
CourseEnrollmentFactory
from
xmodule.modulestore.tests.factories
import
CourseFactory
,
ItemFactory
from
openedx.core.djangoapps.course_groups.cohorts
import
(
get_cohort_by_name
,
remove_user_from_cohort
,
delete_empty_cohort
,
is_user_in_cohort
,
get_course_cohort_names
)
from
openedx.core.djangoapps.course_groups.models
import
CourseUserGroup
from
openedx.core.djangoapps.course_groups.cohorts
import
(
get_cohort_by_name
,
remove_user_from_cohort
,
delete_empty_cohort
,
is_user_in_cohort
,
get_course_cohort_names
)
MODULESTORE_CONFIG
=
mixed_store_config
(
settings
.
COMMON_TEST_DATA_ROOT
,
{},
include_xml
=
False
)
...
...
@@ -468,7 +469,6 @@ class WorkgroupsApiTests(ModuleStoreTestCase):
}
response
=
self
.
do_post
(
self
.
test_peer_reviews_uri
,
pr_data
)
self
.
assertEqual
(
response
.
status_code
,
201
)
pr2_id
=
response
.
data
[
'id'
]
test_uri
=
'{}{}/'
.
format
(
self
.
test_workgroups_uri
,
workgroup_id
)
peer_reviews_uri
=
'{}peer_reviews/'
.
format
(
test_uri
)
...
...
lms/djangoapps/projects/views.py
View file @
de3889f5
...
...
@@ -10,10 +10,8 @@ from rest_framework.decorators import action, link
from
rest_framework
import
status
from
rest_framework.response
import
Response
from
xblock.fields
import
Scope
from
courseware.models
import
StudentModule
from
openedx.core.djangoapps.course_groups.models
import
CourseCohort
from
xblock.runtime
import
KeyValueStore
from
courseware
import
module_render
...
...
@@ -21,7 +19,7 @@ from courseware.courses import get_course
from
courseware.model_data
import
FieldDataCache
from
opaque_keys
import
InvalidKeyError
from
opaque_keys.edx.keys
import
CourseKey
,
UsageKey
from
opaque_keys.edx.locations
import
SlashSeparatedCourseKey
,
Location
from
opaque_keys.edx.locations
import
SlashSeparatedCourseKey
from
xmodule.modulestore
import
Location
,
InvalidLocationError
from
xmodule.modulestore.django
import
modulestore
from
openedx.core.djangoapps.course_groups.cohorts
import
(
...
...
@@ -304,7 +302,7 @@ class WorkgroupsViewSet(viewsets.ModelViewSet):
users
=
User
.
objects
.
filter
(
workgroups
=
pk
)
for
user
in
users
:
module
,
created
=
StudentModule
.
objects
.
get_or_create
(
module
,
_
created
=
StudentModule
.
objects
.
get_or_create
(
student_id
=
user
.
id
,
module_state_key
=
content_key
,
course_id
=
course_key
,
...
...
lms/djangoapps/social_engagement/management/commands/tests/tests.py
View file @
de3889f5
...
...
@@ -6,7 +6,7 @@ paver test_system -s lms --test_id=lms/djangoapps/social_engagements/tests/test_
from
django.conf
import
settings
from
mock
import
MagicMock
,
patch
from
mock
import
patch
from
django.test.utils
import
override_settings
...
...
@@ -15,10 +15,7 @@ from student.models import CourseEnrollment
from
xmodule.modulestore.tests.factories
import
CourseFactory
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
,
mixed_store_config
from
social_engagement.models
import
StudentSocialEngagementScore
,
StudentSocialEngagementScoreHistory
from
social_engagement.engagement
import
update_user_engagement_score
from
social_engagement.engagement
import
update_course_engagement_scores
from
social_engagement.engagement
import
update_all_courses_engagement_scores
from
social_engagement.models
import
StudentSocialEngagementScore
from
edx_notifications.startup
import
initialize
as
initialize_notifications
from
edx_notifications.lib.consumer
import
get_notifications_count_for_user
...
...
lms/static/sass/course/instructor/_instructor_2.scss
View file @
de3889f5
...
...
@@ -970,9 +970,9 @@
border-radius
:
(
$baseline
/
10
);
input
[
type
=
"button"
]
.add
{
@include
idashbutton
(
$blue
);
position
:
absolute
;
@include
right
(
$baseline
);
@include
idashbutton
(
$blue
);
position
:
absolute
;
@include
right
(
$baseline
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment