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
9538ae35
Commit
9538ae35
authored
Sep 11, 2013
by
Adam Palay
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change graders text to unicode
parent
ee627190
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
23 deletions
+33
-23
common/lib/xmodule/xmodule/graders.py
+33
-23
No files found.
common/lib/xmodule/xmodule/graders.py
View file @
9538ae35
...
@@ -183,7 +183,7 @@ class WeightedSubsectionsGrader(CourseGrader):
...
@@ -183,7 +183,7 @@ class WeightedSubsectionsGrader(CourseGrader):
subgrade_result
=
subgrader
.
grade
(
grade_sheet
,
generate_random_scores
)
subgrade_result
=
subgrader
.
grade
(
grade_sheet
,
generate_random_scores
)
weighted_percent
=
subgrade_result
[
'percent'
]
*
weight
weighted_percent
=
subgrade_result
[
'percent'
]
*
weight
section_detail
=
"{0} = {1:.1
%
} of a possible {2:.0
%
}"
.
format
(
category
,
weighted_percent
,
weight
)
section_detail
=
u
"{0} = {1:.1
%
} of a possible {2:.0
%
}"
.
format
(
category
,
weighted_percent
,
weight
)
total_percent
+=
weighted_percent
total_percent
+=
weighted_percent
section_breakdown
+=
subgrade_result
[
'section_breakdown'
]
section_breakdown
+=
subgrade_result
[
'section_breakdown'
]
...
@@ -224,14 +224,16 @@ class SingleSectionGrader(CourseGrader):
...
@@ -224,14 +224,16 @@ class SingleSectionGrader(CourseGrader):
possible
=
found_score
.
possible
possible
=
found_score
.
possible
percent
=
earned
/
float
(
possible
)
percent
=
earned
/
float
(
possible
)
detail
=
"{name} - {percent:.0
%
} ({earned:.3n}/{possible:.3n})"
.
format
(
name
=
self
.
name
,
detail
=
u"{name} - {percent:.0
%
} ({earned:.3n}/{possible:.3n})"
.
format
(
percent
=
percent
,
name
=
self
.
name
,
earned
=
float
(
earned
),
percent
=
percent
,
possible
=
float
(
possible
))
earned
=
float
(
earned
),
possible
=
float
(
possible
)
)
else
:
else
:
percent
=
0.0
percent
=
0.0
detail
=
"{name} - 0
%
(?/?)"
.
format
(
name
=
self
.
name
)
detail
=
u
"{name} - 0
%
(?/?)"
.
format
(
name
=
self
.
name
)
breakdown
=
[{
'percent'
:
percent
,
'label'
:
self
.
short_label
,
breakdown
=
[{
'percent'
:
percent
,
'label'
:
self
.
short_label
,
'detail'
:
detail
,
'category'
:
self
.
category
,
'prominent'
:
True
}]
'detail'
:
detail
,
'category'
:
self
.
category
,
'prominent'
:
True
}]
...
@@ -323,20 +325,26 @@ class AssignmentFormatGrader(CourseGrader):
...
@@ -323,20 +325,26 @@ class AssignmentFormatGrader(CourseGrader):
section_name
=
scores
[
i
]
.
section
section_name
=
scores
[
i
]
.
section
percentage
=
earned
/
float
(
possible
)
percentage
=
earned
/
float
(
possible
)
summary_format
=
"{section_type} {index} - {name} - {percent:.0
%
} ({earned:.3n}/{possible:.3n})"
summary_format
=
u"{section_type} {index} - {name} - {percent:.0
%
} ({earned:.3n}/{possible:.3n})"
summary
=
summary_format
.
format
(
index
=
i
+
self
.
starting_index
,
summary
=
summary_format
.
format
(
section_type
=
self
.
section_type
,
index
=
i
+
self
.
starting_index
,
name
=
section_name
,
section_type
=
self
.
section_type
,
percent
=
percentage
,
name
=
section_name
,
earned
=
float
(
earned
),
percent
=
percentage
,
possible
=
float
(
possible
))
earned
=
float
(
earned
),
possible
=
float
(
possible
)
)
else
:
else
:
percentage
=
0
percentage
=
0
summary
=
"{section_type} {index} Unreleased - 0
%
(?/?)"
.
format
(
index
=
i
+
self
.
starting_index
,
summary
=
u"{section_type} {index} Unreleased - 0
%
(?/?)"
.
format
(
section_type
=
self
.
section_type
)
index
=
i
+
self
.
starting_index
,
section_type
=
self
.
section_type
)
short_label
=
"{short_label} {index:02d}"
.
format
(
index
=
i
+
self
.
starting_index
,
short_label
=
u"{short_label} {index:02d}"
.
format
(
short_label
=
self
.
short_label
)
index
=
i
+
self
.
starting_index
,
short_label
=
self
.
short_label
)
breakdown
.
append
({
'percent'
:
percentage
,
'label'
:
short_label
,
breakdown
.
append
({
'percent'
:
percentage
,
'label'
:
short_label
,
'detail'
:
summary
,
'category'
:
self
.
category
})
'detail'
:
summary
,
'category'
:
self
.
category
})
...
@@ -344,22 +352,24 @@ class AssignmentFormatGrader(CourseGrader):
...
@@ -344,22 +352,24 @@ class AssignmentFormatGrader(CourseGrader):
total_percent
,
dropped_indices
=
total_with_drops
(
breakdown
,
self
.
drop_count
)
total_percent
,
dropped_indices
=
total_with_drops
(
breakdown
,
self
.
drop_count
)
for
dropped_index
in
dropped_indices
:
for
dropped_index
in
dropped_indices
:
breakdown
[
dropped_index
][
'mark'
]
=
{
'detail'
:
"The lowest {drop_count} {section_type} scores are dropped."
breakdown
[
dropped_index
][
'mark'
]
=
{
'detail'
:
u
"The lowest {drop_count} {section_type} scores are dropped."
.
format
(
drop_count
=
self
.
drop_count
,
section_type
=
self
.
section_type
)}
.
format
(
drop_count
=
self
.
drop_count
,
section_type
=
self
.
section_type
)}
if
len
(
breakdown
)
==
1
:
if
len
(
breakdown
)
==
1
:
# if there is only one entry in a section, suppress the existing individual entry and the average,
# if there is only one entry in a section, suppress the existing individual entry and the average,
# and just display a single entry for the section. That way it acts automatically like a
# and just display a single entry for the section. That way it acts automatically like a
# SingleSectionGrader.
# SingleSectionGrader.
total_detail
=
"{section_type} = {percent:.0
%
}"
.
format
(
percent
=
total_percent
,
total_detail
=
u
"{section_type} = {percent:.0
%
}"
.
format
(
percent
=
total_percent
,
section_type
=
self
.
section_type
)
section_type
=
self
.
section_type
)
total_label
=
"{short_label}"
.
format
(
short_label
=
self
.
short_label
)
total_label
=
u
"{short_label}"
.
format
(
short_label
=
self
.
short_label
)
breakdown
=
[{
'percent'
:
total_percent
,
'label'
:
total_label
,
breakdown
=
[{
'percent'
:
total_percent
,
'label'
:
total_label
,
'detail'
:
total_detail
,
'category'
:
self
.
category
,
'prominent'
:
True
},
]
'detail'
:
total_detail
,
'category'
:
self
.
category
,
'prominent'
:
True
},
]
else
:
else
:
total_detail
=
"{section_type} Average = {percent:.0
%
}"
.
format
(
percent
=
total_percent
,
total_detail
=
u"{section_type} Average = {percent:.0
%
}"
.
format
(
section_type
=
self
.
section_type
)
percent
=
total_percent
,
total_label
=
"{short_label} Avg"
.
format
(
short_label
=
self
.
short_label
)
section_type
=
self
.
section_type
)
total_label
=
u"{short_label} Avg"
.
format
(
short_label
=
self
.
short_label
)
if
self
.
show_only_average
:
if
self
.
show_only_average
:
breakdown
=
[]
breakdown
=
[]
...
...
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