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
ba650202
Commit
ba650202
authored
Feb 11, 2013
by
Vik Paruchuri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add in logic to pass settings to peer grading xmodule
parent
323caeb7
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
16 additions
and
42 deletions
+16
-42
common/lib/xmodule/xmodule/combined_open_ended_modulev1.py
+1
-0
common/lib/xmodule/xmodule/peer_grading_module.py
+2
-4
common/lib/xmodule/xmodule/peer_grading_service.py
+0
-28
lms/djangoapps/courseware/module_render.py
+11
-7
lms/envs/aws.py
+2
-3
No files found.
common/lib/xmodule/xmodule/combined_open_ended_modulev1.py
View file @
ba650202
...
...
@@ -205,6 +205,7 @@ class CombinedOpenEndedV1Module():
'display_name'
:
self
.
display_name
,
'accept_file_upload'
:
self
.
accept_file_upload
,
'close_date'
:
self
.
close_date
,
's3_interface'
:
self
.
system
.
s3_interface
,
}
self
.
task_xml
=
definition
[
'task_xml'
]
...
...
common/lib/xmodule/xmodule/peer_grading_module.py
View file @
ba650202
...
...
@@ -3,8 +3,6 @@ import logging
import
requests
import
sys
from
django.conf
import
settings
from
combined_open_ended_rubric
import
CombinedOpenEndedRubric
from
lxml
import
etree
...
...
@@ -25,7 +23,7 @@ from .x_module import XModule
from
.xml_module
import
XmlDescriptor
from
xmodule.modulestore
import
Location
from
peer_grading_service
import
peer_grading_s
ervice
,
GradingServiceError
from
peer_grading_service
import
PeerGradingS
ervice
,
GradingServiceError
log
=
logging
.
getLogger
(
__name__
)
...
...
@@ -62,7 +60,7 @@ class PeerGradingModule(XModule):
#We need to set the location here so the child modules can use it
system
.
set
(
'location'
,
location
)
self
.
system
=
system
self
.
peer_gs
=
peer_grading_service
(
self
.
system
)
self
.
peer_gs
=
PeerGradingService
(
self
.
system
.
open_ended_grading_interface
,
self
.
system
)
self
.
use_for_single_location
=
self
.
metadata
.
get
(
'use_for_single_location'
,
USE_FOR_SINGLE_LOCATION
)
if
isinstance
(
self
.
use_for_single_location
,
basestring
):
...
...
common/lib/xmodule/xmodule/peer_grading_service.py
View file @
ba650202
...
...
@@ -4,12 +4,6 @@ import requests
from
requests.exceptions
import
RequestException
,
ConnectionError
,
HTTPError
import
sys
#TODO: Settings import is needed now in order to specify the URL where to find the peer grading service.
#Eventually, the goal is to replace the global django settings import with settings specifically
#for this xmodule. There is no easy way to do this now, so piggybacking on the django settings
#makes sense.
from
django.conf
import
settings
from
combined_open_ended_rubric
import
CombinedOpenEndedRubric
,
RubricParsingError
from
lxml
import
etree
from
grading_service_module
import
GradingService
,
GradingServiceError
...
...
@@ -144,25 +138,3 @@ class MockPeerGradingService(object):
json
.
dumps
({
'location'
:
'i4x://MITx/3.091x/problem/open_ended_demo2'
,
'problem_name'
:
"Problem 2"
,
'num_graded'
:
1
,
'num_pending'
:
5
})
]})
_service
=
None
def
peer_grading_service
(
system
):
"""
Return a peer grading service instance--if settings.MOCK_PEER_GRADING is True,
returns a mock one, otherwise a real one.
Caches the result, so changing the setting after the first call to this
function will have no effect.
"""
global
_service
if
_service
is
not
None
:
return
_service
if
settings
.
MOCK_PEER_GRADING
:
_service
=
MockPeerGradingService
()
else
:
_service
=
PeerGradingService
(
settings
.
OPEN_ENDED_GRADING_INTERFACE
,
system
)
return
_service
lms/djangoapps/courseware/module_render.py
View file @
ba650202
...
...
@@ -234,16 +234,20 @@ def _get_module(user, request, descriptor, student_module_cache, course_id,
#It needs the open ended grading interface in order to get peer grading to be done
#TODO: refactor these settings into module-specific settings when possible.
#this first checks to see if the descriptor is the correct one, and only sends settings if it is
is_descriptor_combined_open_ended
=
descriptor
.
__class__
.
__name__
==
'CombinedOpenEndedDescriptor'
is_descriptor_combined_open_ended
=
(
descriptor
.
__class__
.
__name__
==
'CombinedOpenEndedDescriptor'
)
is_descriptor_peer_grading
=
(
descriptor
.
__class__
.
__name__
==
'PeerGradingDescriptor'
)
open_ended_grading_interface
=
None
s3_interface
=
None
if
is_descriptor_combined_open_ended
:
if
is_descriptor_combined_open_ended
or
is_descriptor_peer_grading
:
open_ended_grading_interface
=
settings
.
OPEN_ENDED_GRADING_INTERFACE
s3_interface
=
{
'access_key'
:
get_or_default
(
'AWS_ACCESS_KEY_ID'
,
''
),
'secret_access_key'
:
get_or_default
(
'AWS_SECRET_ACCESS_KEY'
,
''
),
'storage_bucket_name'
:
get_or_default
(
'AWS_STORAGE_BUCKET_NAME'
,
''
)
}
open_ended_grading_interface
[
'mock_peer_grading'
]
=
settings
.
MOCK_PEER_GRADING
open_ended_grading_interface
[
'mock_staff_grading'
]
=
settings
.
MOCK_STAFF_GRADING
if
is_descriptor_combined_open_ended
:
s3_interface
=
{
'access_key'
:
get_or_default
(
'AWS_ACCESS_KEY_ID'
,
''
),
'secret_access_key'
:
get_or_default
(
'AWS_SECRET_ACCESS_KEY'
,
''
),
'storage_bucket_name'
:
get_or_default
(
'AWS_STORAGE_BUCKET_NAME'
,
''
)
}
def
inner_get_module
(
descriptor
):
...
...
lms/envs/aws.py
View file @
ba650202
...
...
@@ -110,5 +110,4 @@ PEARSON_TEST_PASSWORD = AUTH_TOKENS.get("PEARSON_TEST_PASSWORD")
PEARSON
=
AUTH_TOKENS
.
get
(
"PEARSON"
)
# Datadog for events!
DATADOG_API
=
AUTH_TOKENS
.
get
(
"DATADOG_API"
)
OPEN_ENDED
\ No newline at end of file
DATADOG_API
=
AUTH_TOKENS
.
get
(
"DATADOG_API"
)
\ No newline at end of file
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