Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hsin-Yu Chien
edx-platform-release
Commits
a99d7f7c
Commit
a99d7f7c
authored
12 years ago
by
Bridger Maxwell
Browse files
Options
Downloads
Patches
Plain Diff
Fixed settings.GENERATE_PROFILE_SCORES for debugging progress graph.
parent
8ba85044
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
common/lib/xmodule/xmodule/graders.py
+26
-2
26 additions, 2 deletions
common/lib/xmodule/xmodule/graders.py
with
26 additions
and
2 deletions
common/lib/xmodule/xmodule/graders.py
+
26
−
2
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
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment