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
588b27c9
Commit
588b27c9
authored
Mar 11, 2013
by
Julian Arni
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added Descriptor method, fixed order issue.
parent
d9b68e2d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
5 deletions
+11
-5
common/lib/xmodule/xmodule/foldit_module.py
+10
-4
lms/djangoapps/foldit/models.py
+1
-1
No files found.
common/lib/xmodule/xmodule/foldit_module.py
View file @
588b27c9
...
...
@@ -86,7 +86,10 @@ class FolditModule(XModule):
"""
from
foldit.models
import
Score
return
[(
e
[
'username'
],
e
[
'score'
])
for
e
in
Score
.
get_tops_n
(
10
)]
leaders
=
[(
e
[
'username'
],
e
[
'score'
])
for
e
in
Score
.
get_tops_n
(
10
)]
leaders
.
sort
(
key
=
lambda
x
:
x
[
1
])
return
leaders
def
get_html
(
self
):
"""
...
...
@@ -173,7 +176,10 @@ class FolditDescriptor(XmlDescriptor, EditingDescriptor):
@classmethod
def
definition_from_xml
(
cls
,
xml_object
,
system
):
"""
Get the xml_object's attributes.
"""
""" Get the xml_object's attributes. """
return
{
'metadata'
:
xml_object
.
attrib
}
def
definition_to_xml
(
self
):
xml_object
=
etree
.
Element
(
'foldit'
)
return
xml_object
lms/djangoapps/foldit/models.py
View file @
588b27c9
...
...
@@ -59,7 +59,7 @@ class Score(models.Model):
scores
=
Score
.
objects
\
.
filter
(
puzzle_id__in
=
puzzles
)
\
.
annotate
(
total_score
=
models
.
Sum
(
'best_score'
))
\
.
order_by
(
'
-
total_score'
)[:
n
]
.
order_by
(
'total_score'
)[:
n
]
num
=
len
(
puzzles
)
return
[{
'username'
:
s
.
user
.
username
,
...
...
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