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
adbcdf54
Commit
adbcdf54
authored
Apr 18, 2014
by
David Ormsbee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Admin screen for ScoreSummary.
parent
1747a2ef
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
1 deletions
+38
-1
apps/submissions/admin.py
+32
-1
apps/submissions/models.py
+6
-0
No files found.
apps/submissions/admin.py
View file @
adbcdf54
...
...
@@ -2,7 +2,7 @@ from django.contrib import admin
from
django.core.urlresolvers
import
reverse
from
django.utils
import
html
from
submissions.models
import
Score
,
StudentItem
,
Submission
from
submissions.models
import
Score
,
S
coreSummary
,
S
tudentItem
,
Submission
class
StudentItemAdminMixin
(
object
):
...
...
@@ -94,6 +94,36 @@ class ScoreAdmin(admin.ModelAdmin, StudentItemAdminMixin):
return
u"{}/{}"
.
format
(
score
.
points_earned
,
score
.
points_possible
)
class
ScoreSummaryAdmin
(
admin
.
ModelAdmin
,
StudentItemAdminMixin
):
list_display
=
(
'id'
,
'course_id'
,
'item_id'
,
'student_id'
,
'student_item_id'
,
'latest'
,
'highest'
,
)
search_fields
=
(
'id'
,
)
+
StudentItemAdminMixin
.
search_fields
readonly_fields
=
(
'student_item_id'
,
'student_item'
,
'highest_link'
,
'latest_link'
)
exclude
=
(
'highest'
,
'latest'
)
def
highest_link
(
self
,
score_summary
):
url
=
reverse
(
'admin:submissions_score_change'
,
args
=
[
score_summary
.
highest
.
id
]
)
return
u'<a href="{}">{}</a>'
.
format
(
url
,
score_summary
.
highest
)
highest_link
.
allow_tags
=
True
highest_link
.
short_description
=
'Highest'
def
latest_link
(
self
,
score_summary
):
url
=
reverse
(
'admin:submissions_score_change'
,
args
=
[
score_summary
.
latest
.
id
]
)
return
u'<a href="{}">{}</a>'
.
format
(
url
,
score_summary
.
latest
)
latest_link
.
allow_tags
=
True
latest_link
.
short_description
=
'Latest'
admin
.
site
.
register
(
Score
,
ScoreAdmin
)
admin
.
site
.
register
(
StudentItem
,
StudentItemAdmin
)
admin
.
site
.
register
(
Submission
,
SubmissionAdmin
)
admin
.
site
.
register
(
ScoreSummary
,
ScoreSummaryAdmin
)
\ No newline at end of file
apps/submissions/models.py
View file @
adbcdf54
...
...
@@ -205,6 +205,9 @@ class Score(models.Model):
reset
=
True
,
)
def
__unicode__
(
self
):
return
u"{0.points_earned}/{0.points_possible}"
.
format
(
self
)
class
ScoreSummary
(
models
.
Model
):
"""Running store of the highest and most recent Scores for a StudentItem."""
...
...
@@ -213,6 +216,9 @@ class ScoreSummary(models.Model):
highest
=
models
.
ForeignKey
(
Score
,
related_name
=
"+"
)
latest
=
models
.
ForeignKey
(
Score
,
related_name
=
"+"
)
class
Meta
:
verbose_name_plural
=
"Score Summaries"
@receiver
(
post_save
,
sender
=
Score
)
def
update_score_summary
(
sender
,
**
kwargs
):
"""
...
...
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