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
a99d7f7c
Commit
a99d7f7c
authored
Sep 28, 2012
by
Bridger Maxwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed settings.GENERATE_PROFILE_SCORES for debugging progress graph.
parent
8ba85044
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
2 deletions
+26
-2
common/lib/xmodule/xmodule/graders.py
+26
-2
No files found.
common/lib/xmodule/xmodule/graders.py
View file @
a99d7f7c
import
abc
import
json
import
logging
import
random
import
sys
from
collections
import
namedtuple
from
django.conf
import
settings
log
=
logging
.
getLogger
(
"mitx.courseware"
)
# This is a tuple for holding scores, either from problems or sections.
...
...
@@ -245,7 +248,16 @@ class SingleSectionGrader(CourseGrader):
foundScore
=
score
break
if
foundScore
:
if
settings
.
GENERATE_PROFILE_SCORES
:
# for debugging!
earned
=
random
.
randint
(
2
,
15
)
possible
=
random
.
randint
(
earned
,
15
)
percent
=
float
(
earned
)
/
possible
detail
=
"{name} - {percent:.0
%
} ({earned:.3n}/{possible:.3n})"
.
format
(
name
=
self
.
name
,
percent
=
percent
,
earned
=
float
(
earned
),
possible
=
float
(
possible
))
elif
foundScore
:
percent
=
foundScore
.
earned
/
float
(
foundScore
.
possible
)
detail
=
"{name} - {percent:.0
%
} ({earned:.3n}/{possible:.3n})"
.
format
(
name
=
self
.
name
,
percent
=
percent
,
...
...
@@ -316,7 +328,19 @@ class AssignmentFormatGrader(CourseGrader):
scores
=
grade_sheet
.
get
(
self
.
type
,
[])
breakdown
=
[]
for
i
in
range
(
max
(
self
.
min_count
,
len
(
scores
))):
if
i
<
len
(
scores
):
print
"scores"
,
scores
if
settings
.
GENERATE_PROFILE_SCORES
:
# for debugging!
earned
=
random
.
randint
(
2
,
15
)
possible
=
random
.
randint
(
earned
,
15
)
percentage
=
float
(
earned
)
/
possible
summary
=
"{section_type} {index} - {name} - {percent:.0
%
} ({earned:.3n}/{possible:.3n})"
.
format
(
index
=
i
+
1
,
section_type
=
self
.
section_type
,
name
=
"Generated"
,
percent
=
percentage
,
earned
=
float
(
earned
),
possible
=
float
(
possible
))
elif
i
<
len
(
scores
):
percentage
=
scores
[
i
]
.
earned
/
float
(
scores
[
i
]
.
possible
)
summary
=
"{section_type} {index} - {name} - {percent:.0
%
} ({earned:.3n}/{possible:.3n})"
.
format
(
index
=
i
+
1
,
section_type
=
self
.
section_type
,
...
...
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