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
1398b557
Commit
1398b557
authored
May 07, 2013
by
Vik Paruchuri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Comment touched modules
parent
9e03280f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
11 deletions
+33
-11
common/lib/xmodule/xmodule/js/src/peergrading/peer_grading.coffee
+2
-0
common/lib/xmodule/xmodule/peer_grading_module.py
+1
-1
lms/djangoapps/open_ended_grading/open_ended_notifications.py
+30
-10
No files found.
common/lib/xmodule/xmodule/js/src/peergrading/peer_grading.coffee
View file @
1398b557
...
...
@@ -10,8 +10,10 @@ class @PeerGrading
@
ajax_url
=
@
peer_grading_container
.
data
(
'ajax-url'
)
if
@
use_single_location
#If the peer grading element is linked to a single location, then activate the backend for that location
@
activate_problem
()
else
#Otherwise, activate the panel view.
@
error_container
=
$
(
'.error-container'
)
@
error_container
.
toggle
(
not
@
error_container
.
is
(
':empty'
))
...
...
common/lib/xmodule/xmodule/peer_grading_module.py
View file @
1398b557
...
...
@@ -93,8 +93,8 @@ class PeerGradingModule(PeerGradingFields, XModule):
if
not
self
.
ajax_url
.
endswith
(
"/"
):
self
.
ajax_url
=
self
.
ajax_url
+
"/"
#This could result in an exception, but not wrapping in a try catch block so it moves up the stack
if
not
isinstance
(
self
.
max_grade
,
int
):
#This could result in an exception, but not wrapping in a try catch block so it moves up the stack
raise
TypeError
(
"max_grade needs to be an integer."
)
def
closed
(
self
):
...
...
lms/djangoapps/open_ended_grading/open_ended_notifications.py
View file @
1398b557
...
...
@@ -105,6 +105,25 @@ def peer_grading_notifications(course, user):
def
combined_notifications
(
course
,
user
):
"""
Show notifications to a given user for a given course. Get notifications from the cache if possible,
or from the grading controller server if not.
@param course: The course object for which we are getting notifications
@param user: The user object for which we are getting notifications
@return: A dictionary with boolean pending_grading (true if there is pending grading), img_path (for notification
image), and response (actual response from grading controller server).
"""
#Set up return values so that we can return them for error cases
pending_grading
=
False
img_path
=
""
notifications
=
{}
notification_dict
=
{
'pending_grading'
:
pending_grading
,
'img_path'
:
img_path
,
'response'
:
notifications
}
#We don't want to show anonymous users anything.
if
not
user
.
is_authenticated
():
return
notification_dict
#Define a mock modulesystem
system
=
ModuleSystem
(
ajax_url
=
None
,
track_function
=
None
,
...
...
@@ -113,44 +132,44 @@ def combined_notifications(course, user):
replace_urls
=
None
,
xblock_model_data
=
{}
)
#Initialize controller query service using our mock system
controller_qs
=
ControllerQueryService
(
settings
.
OPEN_ENDED_GRADING_INTERFACE
,
system
)
student_id
=
unique_id_for_user
(
user
)
user_is_staff
=
has_access
(
user
,
course
,
'staff'
)
course_id
=
course
.
id
notification_type
=
"combined"
#See if we have a stored value in the cache
success
,
notification_dict
=
get_value_from_cache
(
student_id
,
course_id
,
notification_type
)
if
success
:
return
notification_dict
if
user
.
is_authenticated
():
last_login
=
user
.
last_login
else
:
last_login
=
datetime
.
datetime
.
now
()
#Get the time of the last login of the user
last_login
=
user
.
last_login
#Find the modules they have seen since they logged in
last_module_seen
=
StudentModule
.
objects
.
filter
(
student
=
user
,
course_id
=
course_id
,
modified__gt
=
last_login
)
.
values
(
'modified'
)
.
order_by
(
'-modified'
)
last_module_seen_count
=
last_module_seen
.
count
()
if
last_module_seen_count
>
0
:
#The last time they viewed an updated notification (last module seen minus how long notifications are cached)
last_time_viewed
=
last_module_seen
[
0
][
'modified'
]
-
datetime
.
timedelta
(
seconds
=
(
NOTIFICATION_CACHE_TIME
+
60
))
else
:
last_time_viewed
=
last_login
pending_grading
=
False
#If they have not seen any modules since they logged in, then don't refresh
return
{
'pending_grading'
:
False
,
'img_path'
:
img_path
,
'response'
:
notifications
}
img_path
=
""
try
:
#Get the notifications from the grading controller
controller_response
=
controller_qs
.
check_combined_notifications
(
course
.
id
,
student_id
,
user_is_staff
,
last_time_viewed
)
log
.
debug
(
controller_response
)
notifications
=
json
.
loads
(
controller_response
)
if
notifications
[
'success'
]:
if
notifications
[
'overall_need_to_check'
]:
pending_grading
=
True
except
:
#Non catastrophic error, so no real action
notifications
=
{}
#This is a dev_facing_error
log
.
exception
(
"Problem with getting notifications from controller query service for course {0} user {1}."
.
format
(
...
...
@@ -161,6 +180,7 @@ def combined_notifications(course, user):
notification_dict
=
{
'pending_grading'
:
pending_grading
,
'img_path'
:
img_path
,
'response'
:
notifications
}
#Store the notifications in the cache
set_value_in_cache
(
student_id
,
course_id
,
notification_type
,
notification_dict
)
return
notification_dict
...
...
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