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
59b2f2cc
Commit
59b2f2cc
authored
Feb 20, 2013
by
Vik Paruchuri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move controller query service to xmodule side to prepare for ETA message displays
parent
3db3d7b7
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
37 additions
and
22 deletions
+37
-22
common/lib/xmodule/xmodule/open_ended_grading_classes/controller_query_service.py
+16
-3
common/lib/xmodule/xmodule/open_ended_grading_classes/openendedchild.py
+13
-0
lms/djangoapps/open_ended_grading/open_ended_grading_util.py
+0
-13
lms/djangoapps/open_ended_grading/open_ended_notifications.py
+3
-2
lms/djangoapps/open_ended_grading/views.py
+5
-4
No files found.
lms/djangoapps/open_ended_grading
/controller_query_service.py
→
common/lib/xmodule/xmodule/open_ended_grading_classes
/controller_query_service.py
View file @
59b2f2cc
import
logging
import
logging
from
xmodule.open_ended_grading_classes.grading_service_module
import
GradingService
from
xmodule.open_ended_grading_classes.grading_service_module
import
GradingService
from
xmodule.x_module
import
ModuleSystem
from
mitxmako.shortcuts
import
render_to_string
from
mitxmako.shortcuts
import
render_to_string
log
=
logging
.
getLogger
(
__name__
)
log
=
logging
.
getLogger
(
__name__
)
...
@@ -11,8 +10,9 @@ class ControllerQueryService(GradingService):
...
@@ -11,8 +10,9 @@ class ControllerQueryService(GradingService):
"""
"""
Interface to staff grading backend.
Interface to staff grading backend.
"""
"""
def
__init__
(
self
,
config
):
def
__init__
(
self
,
config
,
system
):
config
[
'system'
]
=
ModuleSystem
(
None
,
None
,
None
,
render_to_string
,
None
)
config
[
'system'
]
=
system
#ModuleSystem(None, None, None, render_to_string, None)
super
(
ControllerQueryService
,
self
)
.
__init__
(
config
)
super
(
ControllerQueryService
,
self
)
.
__init__
(
config
)
self
.
url
=
config
[
'url'
]
+
config
[
'grading_controller'
]
self
.
url
=
config
[
'url'
]
+
config
[
'grading_controller'
]
self
.
login_url
=
self
.
url
+
'/login/'
self
.
login_url
=
self
.
url
+
'/login/'
...
@@ -77,3 +77,16 @@ class ControllerQueryService(GradingService):
...
@@ -77,3 +77,16 @@ class ControllerQueryService(GradingService):
response
=
self
.
post
(
self
.
take_action_on_flags_url
,
params
)
response
=
self
.
post
(
self
.
take_action_on_flags_url
,
params
)
return
response
return
response
def
convert_seconds_to_human_readable
(
seconds
):
if
seconds
<
60
:
human_string
=
"{0} seconds"
.
format
(
seconds
)
elif
seconds
<
60
*
60
:
human_string
=
"{0} minutes"
.
format
(
round
(
seconds
/
60
,
1
))
elif
seconds
<
(
24
*
60
*
60
):
human_string
=
"{0} hours"
.
format
(
round
(
seconds
/
(
60
*
60
),
1
))
else
:
human_string
=
"{0} days"
.
format
(
round
(
seconds
/
(
60
*
60
*
24
),
1
))
eta_string
=
"{0}"
.
format
(
human_string
)
return
eta_string
common/lib/xmodule/xmodule/open_ended_grading_classes/openendedchild.py
View file @
59b2f2cc
...
@@ -23,6 +23,7 @@ from xmodule.xml_module import XmlDescriptor
...
@@ -23,6 +23,7 @@ from xmodule.xml_module import XmlDescriptor
from
xmodule.modulestore
import
Location
from
xmodule.modulestore
import
Location
from
capa.util
import
*
from
capa.util
import
*
from
peer_grading_service
import
PeerGradingService
from
peer_grading_service
import
PeerGradingService
import
controller_query_service
from
datetime
import
datetime
from
datetime
import
datetime
...
@@ -106,8 +107,10 @@ class OpenEndedChild(object):
...
@@ -106,8 +107,10 @@ class OpenEndedChild(object):
# completion (doesn't matter if you self-assessed correct/incorrect).
# completion (doesn't matter if you self-assessed correct/incorrect).
self
.
_max_score
=
static_data
[
'max_score'
]
self
.
_max_score
=
static_data
[
'max_score'
]
self
.
peer_gs
=
PeerGradingService
(
system
.
open_ended_grading_interface
,
system
)
self
.
peer_gs
=
PeerGradingService
(
system
.
open_ended_grading_interface
,
system
)
self
.
controller_qs
=
controller_query_service
.
ControllerQueryService
(
system
.
open_ended_grading_interface
,
system
)
self
.
system
=
system
self
.
system
=
system
self
.
location
=
location
self
.
setup_response
(
system
,
location
,
definition
,
descriptor
)
self
.
setup_response
(
system
,
location
,
definition
,
descriptor
)
def
setup_response
(
self
,
system
,
location
,
definition
,
descriptor
):
def
setup_response
(
self
,
system
,
location
,
definition
,
descriptor
):
...
@@ -446,3 +449,13 @@ class OpenEndedChild(object):
...
@@ -446,3 +449,13 @@ class OpenEndedChild(object):
error_message
=
error_string
.
format
(
count_required
-
count_graded
,
count_graded
,
count_required
,
student_sub_count
)
error_message
=
error_string
.
format
(
count_required
-
count_graded
,
count_graded
,
count_required
,
student_sub_count
)
return
success
,
allowed_to_submit
,
error_message
return
success
,
allowed_to_submit
,
error_message
def
get_eta
(
self
):
response
=
self
.
controller_qs
.
check_for_eta
(
self
.
location
.
url
())
try
:
response
=
json
.
loads
(
response
)
except
:
pass
lms/djangoapps/open_ended_grading/open_ended_grading_util.py
deleted
100644 → 0
View file @
3db3d7b7
def
convert_seconds_to_human_readable
(
seconds
):
if
seconds
<
60
:
human_string
=
"{0} seconds"
.
format
(
seconds
)
elif
seconds
<
60
*
60
:
human_string
=
"{0} minutes"
.
format
(
round
(
seconds
/
60
,
1
))
elif
seconds
<
(
24
*
60
*
60
):
human_string
=
"{0} hours"
.
format
(
round
(
seconds
/
(
60
*
60
),
1
))
else
:
human_string
=
"{0} days"
.
format
(
round
(
seconds
/
(
60
*
60
*
24
),
1
))
eta_string
=
"{0}"
.
format
(
human_string
)
return
eta_string
\ No newline at end of file
lms/djangoapps/open_ended_grading/open_ended_notifications.py
View file @
59b2f2cc
from
django.conf
import
settings
from
django.conf
import
settings
from
xmodule.open_ended_grading_classes
import
peer_grading_service
from
xmodule.open_ended_grading_classes
import
peer_grading_service
from
staff_grading_service
import
StaffGradingService
from
staff_grading_service
import
StaffGradingService
from
open_ended_grading
.controller_query_service
import
ControllerQueryService
from
xmodule.open_ended_grading_classes
.controller_query_service
import
ControllerQueryService
import
json
import
json
from
student.models
import
unique_id_for_user
from
student.models
import
unique_id_for_user
from
courseware.models
import
StudentModule
from
courseware.models
import
StudentModule
...
@@ -93,7 +93,8 @@ def peer_grading_notifications(course, user):
...
@@ -93,7 +93,8 @@ def peer_grading_notifications(course, user):
def
combined_notifications
(
course
,
user
):
def
combined_notifications
(
course
,
user
):
controller_qs
=
ControllerQueryService
(
settings
.
OPEN_ENDED_GRADING_INTERFACE
)
system
=
ModuleSystem
(
None
,
None
,
None
,
render_to_string
,
None
)
controller_qs
=
ControllerQueryService
(
settings
.
OPEN_ENDED_GRADING_INTERFACE
,
system
)
student_id
=
unique_id_for_user
(
user
)
student_id
=
unique_id_for_user
(
user
)
user_is_staff
=
has_access
(
user
,
course
,
'staff'
)
user_is_staff
=
has_access
(
user
,
course
,
'staff'
)
course_id
=
course
.
id
course_id
=
course
.
id
...
...
lms/djangoapps/open_ended_grading/views.py
View file @
59b2f2cc
...
@@ -11,7 +11,8 @@ from django.core.urlresolvers import reverse
...
@@ -11,7 +11,8 @@ from django.core.urlresolvers import reverse
from
student.models
import
unique_id_for_user
from
student.models
import
unique_id_for_user
from
courseware.courses
import
get_course_with_access
from
courseware.courses
import
get_course_with_access
from
controller_query_service
import
ControllerQueryService
from
xmodule.x_module
import
ModuleSystem
from
xmodule.open_ended_grading_classes.controller_query_service
import
ControllerQueryService
,
convert_seconds_to_human_readable
from
xmodule.open_ended_grading_classes.grading_service_module
import
GradingServiceError
from
xmodule.open_ended_grading_classes.grading_service_module
import
GradingServiceError
import
json
import
json
from
student.models
import
unique_id_for_user
from
student.models
import
unique_id_for_user
...
@@ -22,13 +23,13 @@ from xmodule.modulestore.django import modulestore
...
@@ -22,13 +23,13 @@ from xmodule.modulestore.django import modulestore
from
xmodule.modulestore
import
search
from
xmodule.modulestore
import
search
from
django.http
import
HttpResponse
,
Http404
,
HttpResponseRedirect
from
django.http
import
HttpResponse
,
Http404
,
HttpResponseRedirect
import
open_ended_grading_util
log
=
logging
.
getLogger
(
__name__
)
log
=
logging
.
getLogger
(
__name__
)
template_imports
=
{
'urllib'
:
urllib
}
template_imports
=
{
'urllib'
:
urllib
}
controller_qs
=
ControllerQueryService
(
settings
.
OPEN_ENDED_GRADING_INTERFACE
)
system
=
ModuleSystem
(
None
,
None
,
None
,
render_to_string
,
None
)
controller_qs
=
ControllerQueryService
(
settings
.
OPEN_ENDED_GRADING_INTERFACE
,
system
)
"""
"""
Reverses the URL from the name and the course id, and then adds a trailing slash if
Reverses the URL from the name and the course id, and then adds a trailing slash if
...
@@ -158,7 +159,7 @@ def student_problem_list(request, course_id):
...
@@ -158,7 +159,7 @@ def student_problem_list(request, course_id):
eta_string
=
"N/A"
eta_string
=
"N/A"
if
eta_available
:
if
eta_available
:
try
:
try
:
eta_string
=
open_ended_grading_util
.
convert_seconds_to_human_readable
(
int
(
problem_list
[
i
][
'eta'
]))
eta_string
=
convert_seconds_to_human_readable
(
int
(
problem_list
[
i
][
'eta'
]))
except
:
except
:
#This is a student_facing_error
#This is a student_facing_error
eta_string
=
"Error getting ETA."
eta_string
=
"Error getting ETA."
...
...
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