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
61983b70
Commit
61983b70
authored
Feb 26, 2012
by
Bridger Maxwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added better random score generation, for recording profile page tutorial
parent
1b936997
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
10 deletions
+17
-10
courseware/views.py
+17
-10
No files found.
courseware/views.py
View file @
61983b70
...
...
@@ -107,6 +107,12 @@ def profile(request):
# total=courseware.modules.capa_module.Module(etree.tostring(p), "id").max_score() # TODO: Add state. Not useful now, but maybe someday problems will have randomized max scores?
# print correct, total
if
settings
.
GENERATE_PROFILE_SCORES
:
if
total
>
1
:
correct
=
random
.
randrange
(
max
(
total
-
2
,
1
)
,
total
+
1
)
else
:
correct
=
total
scores
.
append
((
int
(
correct
),
total
,
graded
))
...
...
@@ -164,11 +170,11 @@ def profile(request):
percentage
=
0
summary
=
"0
%
(?/?)"
if
settings
.
GENERATE_PROFILE_SCORES
:
points_possible
=
random
.
randrange
(
10
,
50
)
points_earned
=
random
.
randrange
(
5
,
points_possible
)
percentage
=
points_earned
/
float
(
points_possible
)
summary
=
"{0:.0
%
} ({1:g}/{2:g})"
.
format
(
percentage
,
points_earned
,
points_possible
)
if
settings
.
GENERATE_PROFILE_SCORES
:
points_possible
=
random
.
randrange
(
10
,
50
)
points_earned
=
random
.
randrange
(
5
,
points_possible
)
percentage
=
points_earned
/
float
(
points_possible
)
summary
=
"{0:.0
%
} ({1:g}/{2:g})"
.
format
(
percentage
,
points_earned
,
points_possible
)
summary
=
"Homework {0} - {1}"
.
format
(
i
+
1
,
summary
)
label
=
"HW {0:02d}"
.
format
(
i
+
1
)
...
...
@@ -179,6 +185,7 @@ def profile(request):
#Figure the lab scores
lab_scores
=
total_scores
[
'Lab'
]
if
'Lab'
in
total_scores
else
[]
lab_percentages
=
[]
print
"lab_scores"
,
lab_scores
for
i
in
range
(
12
):
if
i
<
len
(
lab_scores
):
percentage
=
lab_scores
[
i
][
0
]
/
float
(
lab_scores
[
i
][
1
])
...
...
@@ -187,11 +194,11 @@ def profile(request):
percentage
=
0
summary
=
"0
%
(?/?)"
if
settings
.
GENERATE_PROFILE_SCORES
:
points_possible
=
random
.
randrange
(
10
,
50
)
points_earned
=
random
.
randrange
(
5
,
points_possible
)
percentage
=
points_earned
/
float
(
points_possible
)
summary
=
"{0:.0
%
} ({1:g}/{2:g})"
.
format
(
percentage
,
points_earned
,
points_possible
)
if
settings
.
GENERATE_PROFILE_SCORES
:
points_possible
=
random
.
randrange
(
10
,
50
)
points_earned
=
random
.
randrange
(
5
,
points_possible
)
percentage
=
points_earned
/
float
(
points_possible
)
summary
=
"{0:.0
%
} ({1:g}/{2:g})"
.
format
(
percentage
,
points_earned
,
points_possible
)
summary
=
"Lab {0} - {1}"
.
format
(
i
+
1
,
summary
)
label
=
"Lab {0:02d}"
.
format
(
i
+
1
)
...
...
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