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
a763edab
Commit
a763edab
authored
Apr 16, 2012
by
Bridger Maxwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Just a bit of cleanup. No code changes
parent
fcb530f1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
45 deletions
+40
-45
djangoapps/courseware/__init__.py
+0
-5
djangoapps/courseware/grades.py
+40
-40
No files found.
djangoapps/courseware/__init__.py
View file @
a763edab
...
...
@@ -15,7 +15,6 @@ from courseware.course_settings import GRADER # This won't work.
"""
import
courseware
import
imp
import
logging
...
...
@@ -28,8 +27,6 @@ from courseware import global_course_settings
_log
=
logging
.
getLogger
(
"mitx.courseware"
)
class
Settings
(
object
):
def
__init__
(
self
):
# update this dict from global settings (but only for ALL_CAPS settings)
...
...
@@ -53,5 +50,4 @@ class Settings(object):
setting_value
=
getattr
(
mod
,
setting
)
setattr
(
self
,
setting
,
setting_value
)
course_settings
=
Settings
()
\ No newline at end of file
djangoapps/courseware/grades.py
View file @
a763edab
...
...
@@ -16,7 +16,6 @@ log = logging.getLogger("mitx.courseware")
Score
=
namedtuple
(
"Score"
,
"earned possible graded section"
)
SectionPercentage
=
namedtuple
(
"SectionPercentage"
,
"percentage label summary"
)
class
CourseGrader
(
object
):
"""
A course grader takes the totaled scores for each graded section (that a student has
...
...
@@ -271,45 +270,6 @@ class AssignmentFormatGrader(CourseGrader):
#No grade_breakdown here
}
def
get_score
(
user
,
problem
,
cache
):
## HACK: assumes max score is fixed per problem
id
=
problem
.
get
(
'id'
)
correct
=
0.0
# If the ID is not in the cache, add the item
if
id
not
in
cache
:
module
=
StudentModule
(
module_type
=
'problem'
,
# TODO: Move into StudentModule.__init__?
module_id
=
id
,
student
=
user
,
state
=
None
,
grade
=
0
,
max_grade
=
None
,
done
=
'i'
)
cache
[
id
]
=
module
# Grab the # correct from cache
if
id
in
cache
:
response
=
cache
[
id
]
if
response
.
grade
!=
None
:
correct
=
float
(
response
.
grade
)
# Grab max grade from cache, or if it doesn't exist, compute and save to DB
if
id
in
cache
and
response
.
max_grade
!=
None
:
total
=
response
.
max_grade
else
:
total
=
float
(
courseware
.
modules
.
capa_module
.
Module
(
etree
.
tostring
(
problem
),
"id"
)
.
max_score
())
response
.
max_grade
=
total
response
.
save
()
#Now we re-weight the problem, if specified
weight
=
problem
.
get
(
"weight"
,
None
)
if
weight
:
weight
=
float
(
weight
)
correct
=
correct
*
weight
/
total
total
=
weight
return
(
correct
,
total
)
def
grade_sheet
(
student
):
"""
This pulls a summary of all problems in the course. It returns a dictionary with two datastructures:
...
...
@@ -405,3 +365,43 @@ def aggregate_scores(scores, section_name = "summary"):
section_name
)
return
all_total
,
graded_total
def
get_score
(
user
,
problem
,
cache
):
## HACK: assumes max score is fixed per problem
id
=
problem
.
get
(
'id'
)
correct
=
0.0
# If the ID is not in the cache, add the item
if
id
not
in
cache
:
module
=
StudentModule
(
module_type
=
'problem'
,
# TODO: Move into StudentModule.__init__?
module_id
=
id
,
student
=
user
,
state
=
None
,
grade
=
0
,
max_grade
=
None
,
done
=
'i'
)
cache
[
id
]
=
module
# Grab the # correct from cache
if
id
in
cache
:
response
=
cache
[
id
]
if
response
.
grade
!=
None
:
correct
=
float
(
response
.
grade
)
# Grab max grade from cache, or if it doesn't exist, compute and save to DB
if
id
in
cache
and
response
.
max_grade
!=
None
:
total
=
response
.
max_grade
else
:
total
=
float
(
courseware
.
modules
.
capa_module
.
Module
(
etree
.
tostring
(
problem
),
"id"
)
.
max_score
())
response
.
max_grade
=
total
response
.
save
()
#Now we re-weight the problem, if specified
weight
=
problem
.
get
(
"weight"
,
None
)
if
weight
:
weight
=
float
(
weight
)
correct
=
correct
*
weight
/
total
total
=
weight
return
(
correct
,
total
)
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