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
0887383c
Commit
0887383c
authored
May 21, 2013
by
Vik Paruchuri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't show peer grading button unless there is a peer grading element in the course
parent
15894833
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
20 deletions
+33
-20
lms/djangoapps/open_ended_grading/views.py
+33
-20
No files found.
lms/djangoapps/open_ended_grading/views.py
View file @
0887383c
...
...
@@ -89,6 +89,30 @@ def staff_grading(request, course_id):
# Checked above
'staff_access'
:
True
,
})
def
find_peer_grading_module
(
course
):
#Reverse the base course url
base_course_url
=
reverse
(
'courses'
)
found_module
=
False
problem_url
=
""
#Get the course id and split it
course_id_parts
=
course
.
id
.
split
(
"/"
)
false_dict
=
[
False
,
"False"
,
"false"
,
"FALSE"
]
#TODO: This will not work with multiple runs of a course. Make it work. The last key in the Location passed
#to get_items is called revision. Is this the same as run?
#Get the peer grading modules currently in the course
items
=
modulestore
()
.
get_items
([
'i4x'
,
None
,
course_id_parts
[
1
],
'peergrading'
,
None
])
#See if any of the modules are centralized modules (ie display info from multiple problems)
items
=
[
i
for
i
in
items
if
getattr
(
i
,
"use_for_single_location"
,
True
)
in
false_dict
]
#Get the first one
if
len
(
items
)
>
0
:
item_location
=
items
[
0
]
.
location
#Generate a url for the first module and redirect the user to it
problem_url_parts
=
search
.
path_to_location
(
modulestore
(),
course
.
id
,
item_location
)
problem_url
=
generate_problem_url
(
problem_url_parts
,
base_course_url
)
found_module
=
True
return
found_module
,
problem_url
@cache_control
(
no_cache
=
True
,
no_store
=
True
,
must_revalidate
=
True
)
def
peer_grading
(
request
,
course_id
):
...
...
@@ -98,32 +122,16 @@ def peer_grading(request, course_id):
#Get the current course
course
=
get_course_with_access
(
request
.
user
,
course_id
,
'load'
)
course_id_parts
=
course
.
id
.
split
(
"/"
)
false_dict
=
[
False
,
"False"
,
"false"
,
"FALSE"
]
#Reverse the base course url
base_course_url
=
reverse
(
'courses'
)
try
:
#TODO: This will not work with multiple runs of a course. Make it work. The last key in the Location passed
#to get_items is called revision. Is this the same as run?
#Get the peer grading modules currently in the course
items
=
modulestore
()
.
get_items
([
'i4x'
,
None
,
course_id_parts
[
1
],
'peergrading'
,
None
])
#See if any of the modules are centralized modules (ie display info from multiple problems)
items
=
[
i
for
i
in
items
if
getattr
(
i
,
"use_for_single_location"
,
True
)
in
false_dict
]
#Get the first one
item_location
=
items
[
0
]
.
location
#Generate a url for the first module and redirect the user to it
problem_url_parts
=
search
.
path_to_location
(
modulestore
(),
course
.
id
,
item_location
)
problem_url
=
generate_problem_url
(
problem_url_parts
,
base_course_url
)
return
HttpResponseRedirect
(
problem_url
)
except
:
found_module
,
problem_url
=
find_peer_grading_module
(
course
)
if
not
found_module
:
#This is a student_facing_error
error_message
=
"Error with initializing peer grading. Centralized module does not exist. Please contact course staff."
#This is a dev_facing_error
log
.
exception
(
error_message
+
"Current course is: {0}"
.
format
(
course_id
))
return
HttpResponse
(
error_message
)
return
HttpResponseRedirect
(
problem_url
)
def
generate_problem_url
(
problem_url_parts
,
base_course_url
):
"""
...
...
@@ -300,7 +308,12 @@ def combined_notifications(request, course_id):
'description'
:
description
,
'alert_message'
:
alert_message
}
notification_list
.
append
(
notification_item
)
if
human_name
==
"Peer Grading"
:
found_module
,
problem_url
=
find_peer_grading_module
(
course
)
if
found_module
:
notification_list
.
append
(
notification_item
)
else
:
notification_list
.
append
(
notification_item
)
ajax_url
=
_reverse_with_slash
(
'open_ended_notifications'
,
course_id
)
combined_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