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
7093dadb
Commit
7093dadb
authored
Oct 01, 2015
by
Fred Smith
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #537 from edx-solutions/release
Merge Release into Master
parents
bbd546d9
341fdf46
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
101 additions
and
2 deletions
+101
-2
lms/djangoapps/gradebook/migrations/0004_auto__add_index_studentgradebook_created__add_index_studentgradebook_g.py
+94
-0
lms/djangoapps/gradebook/models.py
+7
-2
No files found.
lms/djangoapps/gradebook/migrations/0004_auto__add_index_studentgradebook_created__add_index_studentgradebook_g.py
0 → 100644
View file @
7093dadb
# -*- coding: utf-8 -*-
# pylint: disable=unused-argument, line-too-long, missing-docstring, invalid-name
from
south.db
import
db
from
south.v2
import
SchemaMigration
class
Migration
(
SchemaMigration
):
def
forwards
(
self
,
orm
):
# Adding index on 'StudentGradebook', fields ['created']
db
.
create_index
(
'gradebook_studentgradebook'
,
[
'created'
])
# Adding index on 'StudentGradebook', fields ['grade']
db
.
create_index
(
'gradebook_studentgradebook'
,
[
'grade'
])
# Adding index on 'StudentGradebook', fields ['modified']
db
.
create_index
(
'gradebook_studentgradebook'
,
[
'modified'
])
def
backwards
(
self
,
orm
):
# Removing index on 'StudentGradebook', fields ['modified']
db
.
delete_index
(
'gradebook_studentgradebook'
,
[
'modified'
])
# Removing index on 'StudentGradebook', fields ['grade']
db
.
delete_index
(
'gradebook_studentgradebook'
,
[
'grade'
])
# Removing index on 'StudentGradebook', fields ['created']
db
.
delete_index
(
'gradebook_studentgradebook'
,
[
'created'
])
models
=
{
'auth.group'
:
{
'Meta'
:
{
'object_name'
:
'Group'
},
'id'
:
(
'django.db.models.fields.AutoField'
,
[],
{
'primary_key'
:
'True'
}),
'name'
:
(
'django.db.models.fields.CharField'
,
[],
{
'unique'
:
'True'
,
'max_length'
:
'80'
}),
'permissions'
:
(
'django.db.models.fields.related.ManyToManyField'
,
[],
{
'to'
:
"orm['auth.Permission']"
,
'symmetrical'
:
'False'
,
'blank'
:
'True'
})
},
'auth.permission'
:
{
'Meta'
:
{
'ordering'
:
"('content_type__app_label', 'content_type__model', 'codename')"
,
'unique_together'
:
"(('content_type', 'codename'),)"
,
'object_name'
:
'Permission'
},
'codename'
:
(
'django.db.models.fields.CharField'
,
[],
{
'max_length'
:
'100'
}),
'content_type'
:
(
'django.db.models.fields.related.ForeignKey'
,
[],
{
'to'
:
"orm['contenttypes.ContentType']"
}),
'id'
:
(
'django.db.models.fields.AutoField'
,
[],
{
'primary_key'
:
'True'
}),
'name'
:
(
'django.db.models.fields.CharField'
,
[],
{
'max_length'
:
'50'
})
},
'auth.user'
:
{
'Meta'
:
{
'object_name'
:
'User'
},
'date_joined'
:
(
'django.db.models.fields.DateTimeField'
,
[],
{
'default'
:
'datetime.datetime.now'
}),
'email'
:
(
'django.db.models.fields.EmailField'
,
[],
{
'max_length'
:
'75'
,
'blank'
:
'True'
}),
'first_name'
:
(
'django.db.models.fields.CharField'
,
[],
{
'max_length'
:
'30'
,
'blank'
:
'True'
}),
'groups'
:
(
'django.db.models.fields.related.ManyToManyField'
,
[],
{
'to'
:
"orm['auth.Group']"
,
'symmetrical'
:
'False'
,
'blank'
:
'True'
}),
'id'
:
(
'django.db.models.fields.AutoField'
,
[],
{
'primary_key'
:
'True'
}),
'is_active'
:
(
'django.db.models.fields.BooleanField'
,
[],
{
'default'
:
'True'
}),
'is_staff'
:
(
'django.db.models.fields.BooleanField'
,
[],
{
'default'
:
'False'
}),
'is_superuser'
:
(
'django.db.models.fields.BooleanField'
,
[],
{
'default'
:
'False'
}),
'last_login'
:
(
'django.db.models.fields.DateTimeField'
,
[],
{
'default'
:
'datetime.datetime.now'
}),
'last_name'
:
(
'django.db.models.fields.CharField'
,
[],
{
'max_length'
:
'30'
,
'blank'
:
'True'
}),
'password'
:
(
'django.db.models.fields.CharField'
,
[],
{
'max_length'
:
'128'
}),
'user_permissions'
:
(
'django.db.models.fields.related.ManyToManyField'
,
[],
{
'to'
:
"orm['auth.Permission']"
,
'symmetrical'
:
'False'
,
'blank'
:
'True'
}),
'username'
:
(
'django.db.models.fields.CharField'
,
[],
{
'unique'
:
'True'
,
'max_length'
:
'30'
})
},
'contenttypes.contenttype'
:
{
'Meta'
:
{
'ordering'
:
"('name',)"
,
'unique_together'
:
"(('app_label', 'model'),)"
,
'object_name'
:
'ContentType'
,
'db_table'
:
"'django_content_type'"
},
'app_label'
:
(
'django.db.models.fields.CharField'
,
[],
{
'max_length'
:
'100'
}),
'id'
:
(
'django.db.models.fields.AutoField'
,
[],
{
'primary_key'
:
'True'
}),
'model'
:
(
'django.db.models.fields.CharField'
,
[],
{
'max_length'
:
'100'
}),
'name'
:
(
'django.db.models.fields.CharField'
,
[],
{
'max_length'
:
'100'
})
},
'gradebook.studentgradebook'
:
{
'Meta'
:
{
'unique_together'
:
"(('user', 'course_id'),)"
,
'object_name'
:
'StudentGradebook'
},
'course_id'
:
(
'xmodule_django.models.CourseKeyField'
,
[],
{
'db_index'
:
'True'
,
'max_length'
:
'255'
,
'blank'
:
'True'
}),
'created'
:
(
'model_utils.fields.AutoCreatedField'
,
[],
{
'default'
:
'datetime.datetime.now'
,
'db_index'
:
'True'
}),
'grade'
:
(
'django.db.models.fields.FloatField'
,
[],
{
'db_index'
:
'True'
}),
'grade_summary'
:
(
'django.db.models.fields.TextField'
,
[],
{
'blank'
:
'True'
}),
'grading_policy'
:
(
'django.db.models.fields.TextField'
,
[],
{
'blank'
:
'True'
}),
'id'
:
(
'django.db.models.fields.AutoField'
,
[],
{
'primary_key'
:
'True'
}),
'modified'
:
(
'model_utils.fields.AutoLastModifiedField'
,
[],
{
'default'
:
'datetime.datetime.now'
,
'db_index'
:
'True'
}),
'proforma_grade'
:
(
'django.db.models.fields.FloatField'
,
[],
{}),
'progress_summary'
:
(
'django.db.models.fields.TextField'
,
[],
{
'blank'
:
'True'
}),
'user'
:
(
'django.db.models.fields.related.ForeignKey'
,
[],
{
'to'
:
"orm['auth.User']"
})
},
'gradebook.studentgradebookhistory'
:
{
'Meta'
:
{
'object_name'
:
'StudentGradebookHistory'
},
'course_id'
:
(
'xmodule_django.models.CourseKeyField'
,
[],
{
'db_index'
:
'True'
,
'max_length'
:
'255'
,
'blank'
:
'True'
}),
'created'
:
(
'model_utils.fields.AutoCreatedField'
,
[],
{
'default'
:
'datetime.datetime.now'
}),
'grade'
:
(
'django.db.models.fields.FloatField'
,
[],
{}),
'grade_summary'
:
(
'django.db.models.fields.TextField'
,
[],
{
'blank'
:
'True'
}),
'grading_policy'
:
(
'django.db.models.fields.TextField'
,
[],
{
'blank'
:
'True'
}),
'id'
:
(
'django.db.models.fields.AutoField'
,
[],
{
'primary_key'
:
'True'
}),
'modified'
:
(
'model_utils.fields.AutoLastModifiedField'
,
[],
{
'default'
:
'datetime.datetime.now'
}),
'proforma_grade'
:
(
'django.db.models.fields.FloatField'
,
[],
{}),
'progress_summary'
:
(
'django.db.models.fields.TextField'
,
[],
{
'blank'
:
'True'
}),
'user'
:
(
'django.db.models.fields.related.ForeignKey'
,
[],
{
'to'
:
"orm['auth.User']"
})
}
}
complete_apps
=
[
'gradebook'
]
lms/djangoapps/gradebook/models.py
View file @
7093dadb
...
...
@@ -8,24 +8,29 @@ from django.db import models
from
django.db.models
import
Avg
,
Max
,
Min
,
Count
from
django.db.models.signals
import
post_save
from
django.dispatch
import
receiver
from
django.utils.translation
import
ugettext_lazy
as
_
from
model_utils.fields
import
AutoCreatedField
,
AutoLastModifiedField
from
model_utils.models
import
TimeStampedModel
from
student.models
import
CourseEnrollment
from
xmodule_django.models
import
CourseKeyField
class
StudentGradebook
(
TimeStamped
Model
):
class
StudentGradebook
(
models
.
Model
):
"""
StudentGradebook is essentially a container used to cache calculated
grades (see courseware.grades.grade), which can be an expensive operation.
"""
user
=
models
.
ForeignKey
(
User
,
db_index
=
True
)
course_id
=
CourseKeyField
(
db_index
=
True
,
max_length
=
255
,
blank
=
True
)
grade
=
models
.
FloatField
()
grade
=
models
.
FloatField
(
db_index
=
True
)
proforma_grade
=
models
.
FloatField
()
progress_summary
=
models
.
TextField
(
blank
=
True
)
grade_summary
=
models
.
TextField
(
blank
=
True
)
grading_policy
=
models
.
TextField
(
blank
=
True
)
# We can't use TimeStampedModel here because those fields are not indexed.
created
=
AutoCreatedField
(
_
(
'created'
),
db_index
=
True
)
modified
=
AutoLastModifiedField
(
_
(
'modified'
),
db_index
=
True
)
class
Meta
:
"""
...
...
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