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
03582928
Commit
03582928
authored
Mar 08, 2013
by
Calen Pennington
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Parse weight as a float when reading from a string
parent
e3f7e602
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
4 deletions
+16
-4
common/lib/xmodule/xmodule/capa_module.py
+15
-3
lms/djangoapps/courseware/grades.py
+1
-1
No files found.
common/lib/xmodule/xmodule/capa_module.py
View file @
03582928
...
...
@@ -29,9 +29,21 @@ class StringyInteger(Integer):
A model type that converts from strings to integers when reading from json
"""
def
from_json
(
self
,
value
):
if
isinstance
(
value
,
basestring
)
:
try
:
return
int
(
value
)
return
value
except
:
return
value
class
StringyFloat
(
Float
):
"""
A model type that converts from string to floats when reading from json
"""
def
from_json
(
self
,
value
):
try
:
return
float
(
value
)
except
:
return
value
# Generated this many different variants of problems with rerandomize=per_student
...
...
@@ -781,7 +793,7 @@ class CapaDescriptor(RawDescriptor):
module_class
=
CapaModule
weight
=
Float
(
help
=
"How much to weight this problem by"
,
scope
=
Scope
.
settings
)
weight
=
Stringy
Float
(
help
=
"How much to weight this problem by"
,
scope
=
Scope
.
settings
)
markdown
=
String
(
help
=
"Markdown source of this module"
,
scope
=
Scope
.
settings
,
default
=
''
)
stores_state
=
True
...
...
lms/djangoapps/courseware/grades.py
View file @
03582928
...
...
@@ -395,7 +395,7 @@ def get_score(course_id, user, problem_descriptor, module_creator, model_data_ca
return
(
None
,
None
)
#Now we re-weight the problem, if specified
weight
=
getattr
(
problem_descriptor
,
'weight'
,
None
)
weight
=
problem_descriptor
.
weight
if
weight
is
not
None
:
if
total
==
0
:
log
.
exception
(
"Cannot reweight a problem with zero total points. Problem: "
+
str
(
student_module
))
...
...
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