Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-ora2
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-ora2
Commits
d06f1545
Commit
d06f1545
authored
Aug 11, 2014
by
Andrew Dekker
Committed by
Andrew Dekker
Aug 12, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added image display in leaderboard
parent
c947e165
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
94 additions
and
5 deletions
+94
-5
openassessment/templates/openassessmentblock/leaderboard/oa_leaderboard_show.html
+6
-1
openassessment/xblock/leaderboard_mixin.py
+3
-1
openassessment/xblock/static/css/openassessment.css
+0
-0
openassessment/xblock/static/sass/oa/utilities/_developer.scss
+9
-1
openassessment/xblock/static/xml/leaderboard.xml
+1
-1
openassessment/xblock/test/data/leaderboard_show_allowfiles.xml
+46
-0
openassessment/xblock/test/test_leaderboard.py
+29
-1
No files found.
openassessment/templates/openassessmentblock/leaderboard/oa_leaderboard_show.html
View file @
d06f1545
...
...
@@ -16,7 +16,12 @@
{% blocktrans %}{{ num_points }} points{% endblocktrans %}
</h4>
{% endwith %}
<div
class=
"leaderboard__answer"
>
{{ topscore.content|linebreaks }}
</div>
<div
class=
"leaderboard__answer"
>
{% if topscore.file %}
<img
class=
"leaderboard__score__image"
alt=
"{% trans "
The
image
associated
with
your
peer
'
s
submission
."
%}"
src=
"{{ topscore.file }}"
/>
{% endif %}
{{ topscore.content|linebreaks }}
</div>
</li>
{% endfor %}
</ol>
...
...
openassessment/xblock/leaderboard_mixin.py
View file @
d06f1545
...
...
@@ -6,7 +6,7 @@ from xblock.core import XBlock
from
openassessment.assessment.errors
import
SelfAssessmentError
,
PeerAssessmentError
from
submissions
import
api
as
sub_api
from
openassessment.fileupload
import
api
as
file_upload_api
class
LeaderboardMixin
(
object
):
"""Leaderboard Mixin introduces all handlers for displaying the leaderboard
...
...
@@ -68,6 +68,8 @@ class LeaderboardMixin(object):
use_cache
=
False
)
for
score
in
scores
:
if
'file_key'
in
score
[
'content'
]:
score
[
'file'
]
=
file_upload_api
.
get_download_url
(
score
[
'content'
][
'file_key'
])
if
'text'
in
score
[
'content'
]:
score
[
'content'
]
=
score
[
'content'
][
'text'
]
elif
isinstance
(
score
[
'content'
],
basestring
):
...
...
openassessment/xblock/static/css/openassessment.css
View file @
d06f1545
This source diff could not be displayed because it is too large. You can
view the blob
instead.
openassessment/xblock/static/sass/oa/utilities/_developer.scss
View file @
d06f1545
...
...
@@ -299,6 +299,14 @@
border-top-left-radius
:
2px
;
}
.leaderboard__score__image
{
max-height
:
150px
;
max-width
:
100%
;
margin-right
:
20px
;
margin-bottom
:
20px
;
float
:left
;
}
.leaderboard__score__title
{
font-size
:
15px
;
color
:
$edx-gray-l1
;
...
...
@@ -310,7 +318,7 @@
.leaderboard__answer
{
border-top
:
2px
solid
$edx-gray-d2
;
box-shadow
:
inset
0
0
3px
1px
rgba
(
10
,
10
,
10
,
0
.1
);
padding
:
5px
10px
;
padding
:
10px
;
max-height
:
200px
;
overflow-y
:
scroll
;
font-size
:
14px
;
...
...
openassessment/xblock/static/xml/leaderboard.xml
View file @
d06f1545
<openassessment
submission_due=
"2030-03-11T18:20"
leaderboard_show=
"10"
>
<openassessment
submission_due=
"2030-03-11T18:20"
leaderboard_show=
"10"
allow_file_upload=
"True"
>
<title>
My favourite pet
</title>
...
...
openassessment/xblock/test/data/leaderboard_show_allowfiles.xml
0 → 100644
View file @
d06f1545
<openassessment
leaderboard_show=
"3"
allow_file_upload=
"True"
>
<title>
Open Assessment Test
</title>
<prompt>
Given the state of the world today, what do you think should be done to
combat poverty? Please answer in a short essay of 200-300 words.
</prompt>
<rubric>
<prompt>
Read for conciseness, clarity of thought, and form.
</prompt>
<criterion>
<name>
𝓒𝓸𝓷𝓬𝓲𝓼𝓮
</name>
<prompt>
How concise is it?
</prompt>
<option
points=
"3"
>
<name>
ﻉซƈﻉɭɭﻉกՇ
</name>
<explanation>
Extremely concise
</explanation>
</option>
<option
points=
"2"
>
<name>
Ġööḋ
</name>
<explanation>
Concise
</explanation>
</option>
<option
points=
"1"
>
<name>
ק๏๏г
</name>
<explanation>
Wordy
</explanation>
</option>
</criterion>
<criterion>
<name>
Form
</name>
<prompt>
How well-formed is it?
</prompt>
<option
points=
"3"
>
<name>
Good
</name>
<explanation>
Good
</explanation>
</option>
<option
points=
"2"
>
<name>
Fair
</name>
<explanation>
Fair
</explanation>
</option>
<option
points=
"1"
>
<name>
Poor
</name>
<explanation>
Poor
</explanation>
</option>
</criterion>
</rubric>
<assessments>
<assessment
name=
"peer-assessment"
must_grade=
"1"
must_be_graded_by=
"1"
/>
<assessment
name=
"self-assessment"
/>
</assessments>
</openassessment>
openassessment/xblock/test/test_leaderboard.py
View file @
d06f1545
...
...
@@ -7,6 +7,11 @@ import mock
from
django.core.cache
import
cache
from
submissions
import
api
as
sub_api
from
.base
import
XBlockHandlerTransactionTestCase
,
scenario
from
django.test.utils
import
override_settings
from
moto
import
mock_s3
import
boto
from
boto.s3.key
import
Key
from
openassessment.fileupload
import
api
class
TestLeaderboardRender
(
XBlockHandlerTransactionTestCase
):
...
...
@@ -81,7 +86,30 @@ class TestLeaderboardRender(XBlockHandlerTransactionTestCase):
# Expect that we default to an empty string for content
self
.
_assert_scores
(
xblock
,
[
{
"content"
:
""
,
"score"
:
1
}
{
"content"
:
""
,
"score"
:
1
,
"file"
:
""
}
])
@mock_s3
@override_settings
(
AWS_ACCESS_KEY_ID
=
'foobar'
,
AWS_SECRET_ACCESS_KEY
=
'bizbaz'
,
FILE_UPLOAD_STORAGE_BUCKET_NAME
=
"mybucket"
)
@scenario
(
'data/leaderboard_show_allowfiles.xml'
)
def
test_image_and_text_submission
(
self
,
xblock
):
# Create a file and get the download URL
conn
=
boto
.
connect_s3
()
bucket
=
conn
.
create_bucket
(
'mybucket'
)
key
=
Key
(
bucket
)
key
.
key
=
"submissions_attachments/foo"
key
.
set_contents_from_string
(
"How d'ya do?"
)
downloadUrl
=
api
.
get_download_url
(
"foo"
)
# Create a image and text submission
self
.
_create_submissions_and_scores
(
xblock
,
[({
"text"
:
"test answer"
,
"file_key"
:
"foo"
},
1
)],
submission_key
=
None
)
# Expect that we retrieve both the text and the download URL for the file
self
.
_assert_scores
(
xblock
,
[
{
"content"
:
"test answer"
,
"score"
:
1
,
"file"
:
downloadUrl
}
])
def
_create_submissions_and_scores
(
...
...
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