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
4ee0e258
Commit
4ee0e258
authored
Sep 30, 2012
by
Bridger Maxwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactored a bit of the generating scores code.
parent
2e4ea1d4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
25 deletions
+22
-25
common/lib/xmodule/xmodule/graders.py
+22
-25
No files found.
common/lib/xmodule/xmodule/graders.py
View file @
4ee0e258
...
@@ -246,21 +246,19 @@ class SingleSectionGrader(CourseGrader):
...
@@ -246,21 +246,19 @@ class SingleSectionGrader(CourseGrader):
foundScore
=
score
foundScore
=
score
break
break
if
generate_random_scores
:
# for debugging!
if
foundScore
or
generate_random_scores
:
earned
=
random
.
randint
(
2
,
15
)
if
generate_random_scores
:
# for debugging!
possible
=
random
.
randint
(
earned
,
15
)
earned
=
random
.
randint
(
2
,
15
)
percent
=
float
(
earned
)
/
possible
possible
=
random
.
randint
(
earned
,
15
)
else
:
# We found the score
earned
=
foundScore
.
earned
possible
=
foundScore
.
possible
percent
=
earned
/
float
(
possible
)
detail
=
"{name} - {percent:.0
%
} ({earned:.3n}/{possible:.3n})"
.
format
(
name
=
self
.
name
,
detail
=
"{name} - {percent:.0
%
} ({earned:.3n}/{possible:.3n})"
.
format
(
name
=
self
.
name
,
percent
=
percent
,
percent
=
percent
,
earned
=
float
(
earned
),
earned
=
float
(
earned
),
possible
=
float
(
possible
))
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
,
earned
=
float
(
foundScore
.
earned
),
possible
=
float
(
foundScore
.
possible
))
else
:
else
:
percent
=
0.0
percent
=
0.0
...
@@ -329,25 +327,24 @@ class AssignmentFormatGrader(CourseGrader):
...
@@ -329,25 +327,24 @@ class AssignmentFormatGrader(CourseGrader):
scores
=
grade_sheet
.
get
(
self
.
type
,
[])
scores
=
grade_sheet
.
get
(
self
.
type
,
[])
breakdown
=
[]
breakdown
=
[]
for
i
in
range
(
max
(
self
.
min_count
,
len
(
scores
))):
for
i
in
range
(
max
(
self
.
min_count
,
len
(
scores
))):
if
generate_random_scores
:
# for debugging!
if
i
<
len
(
scores
)
or
generate_random_scores
:
earned
=
random
.
randint
(
2
,
15
)
if
generate_random_scores
:
# for debugging!
possible
=
random
.
randint
(
earned
,
15
)
earned
=
random
.
randint
(
2
,
15
)
percentage
=
float
(
earned
)
/
possible
possible
=
random
.
randint
(
earned
,
15
)
section_name
=
"Generated"
else
:
earned
=
scores
[
i
]
.
earned
possible
=
scores
[
i
]
.
possible
section_name
=
scores
[
i
]
.
section
percentage
=
earned
/
float
(
possible
)
summary
=
"{section_type} {index} - {name} - {percent:.0
%
} ({earned:.3n}/{possible:.3n})"
.
format
(
index
=
i
+
1
,
summary
=
"{section_type} {index} - {name} - {percent:.0
%
} ({earned:.3n}/{possible:.3n})"
.
format
(
index
=
i
+
1
,
section_type
=
self
.
section_type
,
section_type
=
self
.
section_type
,
name
=
"Generated"
,
name
=
section_name
,
percent
=
percentage
,
percent
=
percentage
,
earned
=
float
(
earned
),
earned
=
float
(
earned
),
possible
=
float
(
possible
))
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
,
name
=
scores
[
i
]
.
section
,
percent
=
percentage
,
earned
=
float
(
scores
[
i
]
.
earned
),
possible
=
float
(
scores
[
i
]
.
possible
))
else
:
else
:
percentage
=
0
percentage
=
0
summary
=
"{section_type} {index} Unreleased - 0
%
(?/?)"
.
format
(
index
=
i
+
1
,
section_type
=
self
.
section_type
)
summary
=
"{section_type} {index} Unreleased - 0
%
(?/?)"
.
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