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
cd2a704a
Commit
cd2a704a
authored
Jan 15, 2013
by
Brian Wilson
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master' into feature/brian/pearson-reg
parents
ef0f973c
78c194aa
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
73 additions
and
7 deletions
+73
-7
lms/djangoapps/courseware/tabs.py
+50
-2
lms/djangoapps/open_ended_grading/peer_grading_service.py
+6
-0
lms/djangoapps/open_ended_grading/staff_grading_service.py
+7
-0
lms/static/coffee/src/staff_grading/staff_grading.coffee
+1
-1
lms/templates/courseware/course_navigation.html
+6
-1
lms/templates/peer_grading/peer_grading.html
+2
-2
lms/templates/peer_grading/peer_grading_problem.html
+1
-1
No files found.
lms/djangoapps/courseware/tabs.py
View file @
cd2a704a
...
...
@@ -11,6 +11,7 @@ actually generates the CourseTab.
from
collections
import
namedtuple
import
logging
import
json
from
django.conf
import
settings
from
django.core.urlresolvers
import
reverse
...
...
@@ -20,6 +21,10 @@ from fs.errors import ResourceNotFoundError
from
courseware.access
import
has_access
from
static_replace
import
replace_urls
from
open_ended_grading.peer_grading_service
import
PeerGradingService
from
open_ended_grading.staff_grading_service
import
StaffGradingService
from
student.models
import
unique_id_for_user
log
=
logging
.
getLogger
(
__name__
)
class
InvalidTabsException
(
Exception
):
...
...
@@ -28,7 +33,10 @@ class InvalidTabsException(Exception):
"""
pass
CourseTab
=
namedtuple
(
'CourseTab'
,
'name link is_active'
)
CourseTabBase
=
namedtuple
(
'CourseTab'
,
'name link is_active has_img img'
)
def
CourseTab
(
name
,
link
,
is_active
,
has_img
=
False
,
img
=
""
):
return
CourseTabBase
(
name
,
link
,
is_active
,
has_img
,
img
)
# encapsulate implementation for a tab:
# - a validation function: takes the config dict and raises
...
...
@@ -101,9 +109,48 @@ def _textbooks(tab, user, course, active_page):
def
_staff_grading
(
tab
,
user
,
course
,
active_page
):
if
has_access
(
user
,
course
,
'staff'
):
link
=
reverse
(
'staff_grading'
,
args
=
[
course
.
id
])
return
[
CourseTab
(
'Staff grading'
,
link
,
active_page
==
"staff_grading"
)]
staff_gs
=
StaffGradingService
(
settings
.
STAFF_GRADING_INTERFACE
)
pending_grading
=
False
tab_name
=
"Staff grading"
img_path
=
""
try
:
notifications
=
json
.
loads
(
staff_gs
.
get_notifications
(
course
.
id
))
if
notifications
[
'success'
]:
if
notifications
[
'staff_needs_to_grade'
]:
pending_grading
=
True
except
:
#Non catastrophic error, so no real action
log
.
info
(
"Problem with getting notifications from staff grading service."
)
if
pending_grading
:
img_path
=
"/static/images/slider-handle.png"
tab
=
[
CourseTab
(
tab_name
,
link
,
active_page
==
"staff_grading"
,
pending_grading
,
img_path
)]
return
tab
return
[]
def
_peer_grading
(
tab
,
user
,
course
,
active_page
):
if
user
.
is_authenticated
():
link
=
reverse
(
'peer_grading'
,
args
=
[
course
.
id
])
peer_gs
=
PeerGradingService
(
settings
.
PEER_GRADING_INTERFACE
)
pending_grading
=
False
tab_name
=
"Peer grading"
img_path
=
""
try
:
notifications
=
json
.
loads
(
peer_gs
.
get_notifications
(
course
.
id
,
unique_id_for_user
(
user
)))
if
notifications
[
'success'
]:
if
notifications
[
'student_needs_to_peer_grade'
]:
pending_grading
=
True
except
:
#Non catastrophic error, so no real action
log
.
info
(
"Problem with getting notifications from peer grading service."
)
if
pending_grading
:
img_path
=
"/static/images/slider-handle.png"
tab
=
[
CourseTab
(
tab_name
,
link
,
active_page
==
"peer_grading"
,
pending_grading
,
img_path
)]
return
tab
return
[]
#### Validators
...
...
@@ -140,6 +187,7 @@ VALID_TAB_TYPES = {
'textbooks'
:
TabImpl
(
null_validator
,
_textbooks
),
'progress'
:
TabImpl
(
need_name
,
_progress
),
'static_tab'
:
TabImpl
(
key_checker
([
'name'
,
'url_slug'
]),
_static_tab
),
'peer_grading'
:
TabImpl
(
null_validator
,
_peer_grading
),
'staff_grading'
:
TabImpl
(
null_validator
,
_staff_grading
),
}
...
...
lms/djangoapps/open_ended_grading/peer_grading_service.py
View file @
cd2a704a
...
...
@@ -79,6 +79,7 @@ class PeerGradingService(GradingService):
self
.
show_calibration_essay_url
=
self
.
url
+
'/show_calibration_essay/'
self
.
save_calibration_essay_url
=
self
.
url
+
'/save_calibration_essay/'
self
.
get_problem_list_url
=
self
.
url
+
'/get_problem_list/'
self
.
get_notifications_url
=
self
.
url
+
'/get_notifications/'
def
get_next_submission
(
self
,
problem_location
,
grader_id
):
response
=
self
.
get
(
self
.
get_next_submission_url
,
...
...
@@ -116,6 +117,11 @@ class PeerGradingService(GradingService):
response
=
self
.
get
(
self
.
get_problem_list_url
,
params
)
return
response
def
get_notifications
(
self
,
course_id
,
grader_id
):
params
=
{
'course_id'
:
course_id
,
'student_id'
:
grader_id
}
response
=
self
.
get
(
self
.
get_notifications_url
,
params
)
return
response
_service
=
None
def
peer_grading_service
():
...
...
lms/djangoapps/open_ended_grading/staff_grading_service.py
View file @
cd2a704a
...
...
@@ -66,6 +66,7 @@ class StaffGradingService(GradingService):
self
.
get_next_url
=
self
.
url
+
'/get_next_submission/'
self
.
save_grade_url
=
self
.
url
+
'/save_grade/'
self
.
get_problem_list_url
=
self
.
url
+
'/get_problem_list/'
self
.
get_notifications_url
=
self
.
url
+
"/get_notifications/"
def
get_problem_list
(
self
,
course_id
,
grader_id
):
...
...
@@ -132,6 +133,12 @@ class StaffGradingService(GradingService):
return
self
.
post
(
self
.
save_grade_url
,
data
=
data
)
def
get_notifications
(
self
,
course_id
):
params
=
{
'course_id'
:
course_id
}
response
=
self
.
get
(
self
.
get_notifications_url
,
params
)
return
response
# don't initialize until staff_grading_service() is called--means that just
# importing this file doesn't create objects that may not have the right config
_service
=
None
...
...
lms/static/coffee/src/staff_grading/staff_grading.coffee
View file @
cd2a704a
...
...
@@ -318,7 +318,7 @@ class StaffGrading
problem_link
:
(
problem
)
->
link
=
$
(
'<a>'
).
attr
(
'href'
,
"javascript:void(0)"
).
append
(
"
#{
problem
.
problem_name
}
(
#{
problem
.
num_graded
}
graded,
#{
problem
.
num_pending
}
pending)"
)
"
#{
problem
.
problem_name
}
(
#{
problem
.
num_graded
}
graded,
#{
problem
.
num_pending
}
pending
, required to grade
#{
problem
.
num_required
}
more
)"
)
.
click
=>
@
get_next_submission
problem
.
location
...
...
lms/templates/courseware/course_navigation.html
View file @
cd2a704a
...
...
@@ -18,7 +18,12 @@ def url_class(is_active):
<ol
class=
"course-tabs"
>
% for tab in get_course_tabs(user, course, active_page):
<li>
<a
href=
"${tab.link | h}"
class=
"${url_class(tab.is_active)}"
>
${tab.name | h}
</a>
<a
href=
"${tab.link | h}"
class=
"${url_class(tab.is_active)}"
>
${tab.name | h}
% if tab.has_img == True:
<img
src=
"${tab.img}"
/>
%endif
</a>
</li>
% endfor
<
%
block
name=
"extratabs"
/>
...
...
lms/templates/peer_grading/peer_grading.html
View file @
cd2a704a
...
...
@@ -8,7 +8,7 @@
<
%
block
name=
"title"
><title>
${course.number} Peer Grading
</title></
%
block>
<
%
include
file=
"/courseware/course_navigation.html"
args=
"active_page='
staff
_grading'"
/>
<
%
include
file=
"/courseware/course_navigation.html"
args=
"active_page='
peer
_grading'"
/>
<
%
block
name=
"js_extra"
>
<
%
static:js
group=
'peer_grading'
/>
...
...
@@ -29,7 +29,7 @@
<ul
class=
"problem-list"
>
%for problem in problem_list:
<li>
<a
href=
"${ajax_url}problem?location=${problem['location']}"
>
${problem['problem_name']} (${problem['num_graded']} graded, ${problem['num_pending']} pending)
</a>
<a
href=
"${ajax_url}problem?location=${problem['location']}"
>
${problem['problem_name']} (${problem['num_graded']} graded, ${problem['num_pending']} pending
, required to grade ${problem['num_required']} more
)
</a>
</li>
%endfor
</ul>
...
...
lms/templates/peer_grading/peer_grading_problem.html
View file @
cd2a704a
...
...
@@ -9,7 +9,7 @@
<
%
block
name=
"title"
><title>
${course.number} Peer Grading.
</title></
%
block>
<
%
include
file=
"/courseware/course_navigation.html"
args=
"active_page='
staff
_grading'"
/>
<
%
include
file=
"/courseware/course_navigation.html"
args=
"active_page='
peer
_grading'"
/>
<
%
block
name=
"js_extra"
>
<
%
static:js
group=
'peer_grading'
/>
...
...
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