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
0d593010
Commit
0d593010
authored
Dec 10, 2013
by
John Jarvis
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1906 from edx/hotfix/2013-12-10
Hotfix/2013 12 10
parents
ddc45ea5
aba25c2d
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
62 additions
and
13 deletions
+62
-13
cms/djangoapps/auth/authz.py
+6
-9
common/lib/xmodule/xmodule/open_ended_grading_classes/combined_open_ended_modulev1.py
+17
-2
common/lib/xmodule/xmodule/open_ended_grading_classes/open_ended_module.py
+39
-1
common/lib/xmodule/xmodule/tests/test_combined_open_ended.py
+0
-0
common/lib/xmodule/xmodule/tests/test_util_open_ended.py
+0
-0
lms/djangoapps/courseware/roles.py
+0
-1
No files found.
cms/djangoapps/auth/authz.py
View file @
0d593010
...
...
@@ -63,7 +63,7 @@ def get_all_course_role_groupnames(location, role, use_filter=True):
# filter to the ones which exist
default
=
groupnames
[
0
]
if
use_filter
:
groupnames
=
[
group
for
group
in
groupnames
if
Group
.
objects
.
filter
(
name
=
group
)
.
exists
(
)]
groupnames
=
[
group
.
name
for
group
in
Group
.
objects
.
filter
(
name__in
=
groupnames
)]
return
groupnames
,
default
...
...
@@ -203,12 +203,9 @@ def remove_user_from_course_group(caller, user, location, role):
# see if the user is actually in that role, if not then we don't have to do anything
groupnames
,
_
=
get_all_course_role_groupnames
(
location
,
role
)
for
groupname
in
groupnames
:
groups
=
user
.
groups
.
filter
(
name
=
groupname
)
if
groups
:
# will only be one with that name
user
.
groups
.
remove
(
groups
[
0
])
user
.
save
()
for
group
in
user
.
groups
.
filter
(
name__in
=
groupnames
):
user
.
groups
.
remove
(
group
)
user
.
save
()
def
remove_user_from_creator_group
(
caller
,
user
):
...
...
@@ -243,7 +240,7 @@ def is_user_in_course_group_role(user, location, role, check_staff=True):
if
check_staff
and
user
.
is_staff
:
return
True
groupnames
,
_
=
get_all_course_role_groupnames
(
location
,
role
)
return
any
(
user
.
groups
.
filter
(
name
=
groupname
)
.
exists
()
for
groupname
in
groupnames
)
return
user
.
groups
.
filter
(
name__in
=
groupnames
)
.
exists
(
)
return
False
...
...
@@ -266,7 +263,7 @@ def is_user_in_creator_group(user):
# Feature flag for using the creator group setting. Will be removed once the feature is complete.
if
settings
.
MITX_FEATURES
.
get
(
'ENABLE_CREATOR_GROUP'
,
False
):
return
user
.
groups
.
filter
(
name
=
COURSE_CREATOR_GROUP_NAME
)
.
count
()
>
0
return
user
.
groups
.
filter
(
name
=
COURSE_CREATOR_GROUP_NAME
)
.
exists
()
return
True
...
...
common/lib/xmodule/xmodule/open_ended_grading_classes/combined_open_ended_modulev1.py
View file @
0d593010
...
...
@@ -258,8 +258,23 @@ class CombinedOpenEndedV1Module():
if
not
task_states
:
return
(
0
,
0
,
state_values
[
OpenEndedChild
.
INITIAL
],
idx
)
final_child_state
=
json
.
loads
(
task_states
[
-
1
])
scores
=
[
attempt
.
get
(
'score'
,
0
)
for
attempt
in
final_child_state
.
get
(
'child_history'
,
[])]
final_task_xml
=
self
.
task_xml
[
-
1
]
final_child_state_json
=
task_states
[
-
1
]
final_child_state
=
json
.
loads
(
final_child_state_json
)
tag_name
=
self
.
get_tag_name
(
final_task_xml
)
children
=
self
.
child_modules
()
task_descriptor
=
children
[
'descriptors'
][
tag_name
](
self
.
system
)
task_parsed_xml
=
task_descriptor
.
definition_from_xml
(
etree
.
fromstring
(
final_task_xml
),
self
.
system
)
task
=
children
[
'modules'
][
tag_name
](
self
.
system
,
self
.
location
,
task_parsed_xml
,
task_descriptor
,
self
.
static_data
,
instance_state
=
final_child_state_json
,
)
scores
=
task
.
all_scores
()
if
scores
:
best_score
=
max
(
scores
)
else
:
...
...
common/lib/xmodule/xmodule/open_ended_grading_classes/open_ended_module.py
View file @
0d593010
...
...
@@ -679,7 +679,7 @@ class OpenEndedModule(openendedchild.OpenEndedChild):
return
{
'success'
:
success
,
'error'
:
error_message
,
'student_response'
:
data
[
'student_answer'
]
.
replace
(
"
\n
"
,
"<br/>"
)
'student_response'
:
data
[
'student_answer'
]
.
replace
(
"
\n
"
,
"<br/>"
)
}
def
update_score
(
self
,
data
,
system
):
...
...
@@ -738,6 +738,44 @@ class OpenEndedModule(openendedchild.OpenEndedChild):
html
=
system
.
render_template
(
'{0}/open_ended.html'
.
format
(
self
.
TEMPLATE_DIR
),
context
)
return
html
def
latest_score
(
self
):
"""None if not available"""
if
not
self
.
child_history
:
return
None
return
self
.
score_for_attempt
(
-
1
)
def
all_scores
(
self
):
"""None if not available"""
if
not
self
.
child_history
:
return
None
return
[
self
.
score_for_attempt
(
index
)
for
index
in
xrange
(
0
,
len
(
self
.
child_history
))]
def
score_for_attempt
(
self
,
index
):
"""
Return sum of rubric scores for ML grading otherwise return attempt["score"].
"""
attempt
=
self
.
child_history
[
index
]
score
=
attempt
.
get
(
'score'
)
post_assessment_data
=
self
.
_parse_score_msg
(
attempt
.
get
(
'post_assessment'
),
self
.
system
)
grader_types
=
post_assessment_data
.
get
(
'grader_types'
)
# According to _parse_score_msg in ML grading there should be only one grader type.
if
len
(
grader_types
)
==
1
and
grader_types
[
0
]
==
'ML'
:
rubric_scores
=
post_assessment_data
.
get
(
"rubric_scores"
)
# Similarly there should be only one list of rubric scores.
if
len
(
rubric_scores
)
==
1
:
rubric_scores_sum
=
sum
(
rubric_scores
[
0
])
log
.
debug
(
"""Score normalized for location={loc}, old_score={old_score},
new_score={new_score}, rubric_score={rubric_score}"""
.
format
(
loc
=
self
.
location_string
,
old_score
=
score
,
new_score
=
rubric_scores_sum
,
rubric_score
=
rubric_scores
))
return
rubric_scores_sum
return
score
class
OpenEndedDescriptor
():
"""
...
...
common/lib/xmodule/xmodule/tests/test_combined_open_ended.py
View file @
0d593010
This diff is collapsed.
Click to expand it.
common/lib/xmodule/xmodule/tests/test_util_open_ended.py
View file @
0d593010
This diff is collapsed.
Click to expand it.
lms/djangoapps/courseware/roles.py
View file @
0d593010
...
...
@@ -4,7 +4,6 @@ adding users, removing users, and listing members
"""
from
abc
import
ABCMeta
,
abstractmethod
from
functools
import
partial
from
django.contrib.auth.models
import
User
,
Group
...
...
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