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
0f212cc8
Commit
0f212cc8
authored
Jan 22, 2013
by
Vik Paruchuri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix course id passing, template rendering
parent
6b7ba379
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
12 deletions
+31
-12
lms/djangoapps/courseware/tabs.py
+3
-3
lms/djangoapps/open_ended_grading/open_ended_notifications.py
+16
-5
lms/djangoapps/open_ended_grading/views.py
+8
-3
lms/urls.py
+4
-1
No files found.
lms/djangoapps/courseware/tabs.py
View file @
0f212cc8
...
...
@@ -109,7 +109,7 @@ def _staff_grading(tab, user, course, active_page):
link
=
reverse
(
'staff_grading'
,
args
=
[
course
.
id
])
tab_name
=
"Staff grading"
notifications
=
open_ended_notifications
.
staff_grading_notifications
(
course
_id
)
notifications
=
open_ended_notifications
.
staff_grading_notifications
(
course
)
pending_grading
=
notifications
[
'pending_grading'
]
img_path
=
notifications
[
'img_path'
]
...
...
@@ -122,7 +122,7 @@ def _peer_grading(tab, user, course, active_page):
link
=
reverse
(
'peer_grading'
,
args
=
[
course
.
id
])
tab_name
=
"Peer grading"
notifications
=
open_ended_notifications
.
peer_grading_notifications
(
course
_id
,
user
)
notifications
=
open_ended_notifications
.
peer_grading_notifications
(
course
,
user
)
pending_grading
=
notifications
[
'pending_grading'
]
img_path
=
notifications
[
'img_path'
]
...
...
@@ -135,7 +135,7 @@ def _combined_open_ended_grading(tab, user, course, active_page):
link
=
reverse
(
'open_ended_problems'
,
args
=
[
course
.
id
])
tab_name
=
"Open Ended Questions"
notifications
=
open_ended_notifications
.
combined_notifications
(
course
_id
,
user
)
notifications
=
open_ended_notifications
.
combined_notifications
(
course
,
user
)
pending_grading
=
notifications
[
'pending_grading'
]
img_path
=
notifications
[
'img_path'
]
...
...
lms/djangoapps/open_ended_grading/open_ended_notifications.py
View file @
0f212cc8
...
...
@@ -6,6 +6,10 @@ import json
from
student.models
import
unique_id_for_user
import
open_ended_util
from
courseware.models
import
StudentModule
import
logging
from
courseware.access
import
has_access
log
=
logging
.
getLogger
(
__name__
)
NOTIFICATION_TYPES
=
(
(
'student_needs_to_peer_grade'
,
'peer_grading'
,
'Peer Grading'
),
...
...
@@ -13,10 +17,11 @@ NOTIFICATION_TYPES = (
(
'overall_need_to_check'
,
'open_ended_problems'
,
'Problems you have submitted'
)
)
def
staff_grading_notifications
(
course
_id
):
def
staff_grading_notifications
(
course
):
staff_gs
=
StaffGradingService
(
settings
.
STAFF_GRADING_INTERFACE
)
pending_grading
=
False
img_path
=
""
course_id
=
course
.
id
try
:
notifications
=
json
.
loads
(
staff_gs
.
get_notifications
(
course_id
))
if
notifications
[
'success'
]:
...
...
@@ -24,6 +29,7 @@ def staff_grading_notifications(course_id):
pending_grading
=
True
except
:
#Non catastrophic error, so no real action
notifications
=
{}
log
.
info
(
"Problem with getting notifications from staff grading service."
)
if
pending_grading
:
...
...
@@ -31,10 +37,12 @@ def staff_grading_notifications(course_id):
return
{
'pending_grading'
:
pending_grading
,
'img_path'
:
img_path
,
'response'
:
notifications
}
def
peer_grading_notifications
(
course
_id
,
user
):
def
peer_grading_notifications
(
course
,
user
):
peer_gs
=
PeerGradingService
(
settings
.
PEER_GRADING_INTERFACE
)
pending_grading
=
False
img_path
=
""
course_id
=
course
.
id
try
:
notifications
=
json
.
loads
(
peer_gs
.
get_notifications
(
course_id
,
unique_id_for_user
(
user
)))
if
notifications
[
'success'
]:
...
...
@@ -42,6 +50,7 @@ def peer_grading_notifications(course_id, user):
pending_grading
=
True
except
:
#Non catastrophic error, so no real action
notifications
=
{}
log
.
info
(
"Problem with getting notifications from peer grading service."
)
if
pending_grading
:
...
...
@@ -49,14 +58,15 @@ def peer_grading_notifications(course_id, user):
return
{
'pending_grading'
:
pending_grading
,
'img_path'
:
img_path
,
'response'
:
notifications
}
def
combined_notifications
(
course
_id
,
user
):
def
combined_notifications
(
course
,
user
):
controller_url
=
open_ended_util
.
get_controller_url
()
controller_qs
=
ControllerQueryService
(
controller_url
)
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
min_time_to_query
=
user
.
last_login
last_module_seen
=
StudentModule
.
objects
.
all
(
student
=
user
,
course_id
=
course_id
,
modified__gt
=
min_time_to_query
)
.
values
(
'modified'
)
.
order_by
(
'-modified'
)[
0
]
last_module_seen
=
StudentModule
.
objects
.
filter
(
student
=
user
,
course_id
=
course_id
,
modified__gt
=
min_time_to_query
)
.
values
(
'modified'
)
.
order_by
(
'-modified'
)[
0
]
last_time_viewed
=
last_module_seen
[
'modified'
]
pending_grading
=
False
...
...
@@ -69,6 +79,7 @@ def combined_notifications(course_id, user):
pending_grading
=
True
except
:
#Non catastrophic error, so no real action
notifications
=
{}
log
.
info
(
"Problem with getting notifications from controller query service."
)
if
pending_grading
:
...
...
lms/djangoapps/open_ended_grading/views.py
View file @
0f212cc8
...
...
@@ -165,10 +165,12 @@ def student_problem_list(request, course_id):
@cache_control
(
no_cache
=
True
,
no_store
=
True
,
must_revalidate
=
True
)
def
combined_notifications
(
request
,
course_id
):
course
=
get_course_with_access
(
request
.
user
,
course_id
,
'load'
)
user
=
request
.
user
notifications
=
open_ended_notifications
.
combined_notifications
(
course
_id
,
user
)
notifications
=
open_ended_notifications
.
combined_notifications
(
course
,
user
)
response
=
notifications
[
'response'
]
notificaton_tuples
=
open_ended_notifications
.
NOTIFICATION_TYPES
notification_tuples
=
open_ended_notifications
.
NOTIFICATION_TYPES
notification_list
=
[]
for
response_num
in
xrange
(
0
,
len
(
notification_tuples
)):
...
...
@@ -191,8 +193,11 @@ def combined_notifications(request, course_id):
combined_dict
=
{
'error_text'
:
""
,
'notification_list'
:
notification_list
,
'course'
:
course
,
}
return
combined_dict
return
render_to_response
(
'open_ended_problems/combined_notifications.html'
,
combined_dict
)
lms/urls.py
View file @
0f212cc8
...
...
@@ -285,7 +285,7 @@ if settings.COURSEWARE_ENABLED:
# Open Ended problem list
url
(
r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/open_ended_problems$'
,
'open_ended_grading.views.student_problem_list'
,
name
=
'open_ended_problems'
),
# Cohorts management
url
(
r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/cohorts$'
,
'course_groups.views.list_cohorts'
,
name
=
"cohorts"
),
...
...
@@ -305,6 +305,9 @@ if settings.COURSEWARE_ENABLED:
'course_groups.views.debug_cohort_mgmt'
,
name
=
"debug_cohort_mgmt"
),
# Open Ended Notifications
url
(
r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/open_ended_notifications$'
,
'open_ended_grading.views.combined_notifications'
,
name
=
'open_ended_notifications'
),
)
# discussion forums live within courseware, so courseware must be enabled first
...
...
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