Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added a model for tracking progress in the current session

  • Loading branch information...
commit b93fdeb0221e31953df3cd08bdf4dc0ad7b2b0b2 1 parent e90c10d
@matthewstevens matthewstevens authored
View
3  README.rst
@@ -24,3 +24,6 @@ Result analysis
New word selection
- select word with lowest attempt value
+
+To Consider
+ - retire old state
View
106 minerva/migrations/0016_session_tracking_model.py
@@ -0,0 +1,106 @@
+# encoding: utf-8
+import datetime
+from south.db import db
+from south.v2 import SchemaMigration
+from django.db import models
+
+class Migration(SchemaMigration):
+
+ def forwards(self, orm):
+
+ # Adding model 'SessionProgress'
+ db.create_table('minerva_sessionprogress', (
+ ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+ ('student', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'], null=True, blank=True)),
+ ('anon_student', self.gf('django.db.models.fields.CharField')(max_length=32, null=True, blank=True)),
+ ('word', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['minerva.Word'])),
+ ('weight', self.gf('django.db.models.fields.IntegerField')(default=0)),
+ ('correct', self.gf('django.db.models.fields.IntegerField')(default=0)),
+ ))
+ db.send_create_signal('minerva', ['SessionProgress'])
+
+
+ def backwards(self, orm):
+
+ # Deleting model 'SessionProgress'
+ db.delete_table('minerva_sessionprogress')
+
+
+ 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'})
+ },
+ 'minerva.language': {
+ 'Meta': {'object_name': 'Language'},
+ 'code': ('django.db.models.fields.CharField', [], {'max_length': '3'}),
+ 'descriptive_name': ('django.db.models.fields.CharField', [], {'max_length': '50'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
+ },
+ 'minerva.progress': {
+ 'Meta': {'object_name': 'Progress'},
+ 'anon_student': ('django.db.models.fields.CharField', [], {'max_length': '32', 'null': 'True', 'blank': 'True'}),
+ 'attempts': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
+ 'correct': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'student': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}),
+ 'word': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['minerva.Word']"})
+ },
+ 'minerva.sessionprogress': {
+ 'Meta': {'object_name': 'SessionProgress'},
+ 'anon_student': ('django.db.models.fields.CharField', [], {'max_length': '32', 'null': 'True', 'blank': 'True'}),
+ 'correct': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'student': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}),
+ 'weight': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
+ 'word': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['minerva.Word']"})
+ },
+ 'minerva.userprofile': {
+ 'Meta': {'object_name': 'UserProfile'},
+ 'language': ('django.db.models.fields.CharField', [], {'max_length': '3', 'null': 'True', 'blank': 'True'}),
+ 'student': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['auth.User']", 'unique': 'True', 'primary_key': 'True'})
+ },
+ 'minerva.word': {
+ 'Meta': {'unique_together': "(('word', 'lang_code'),)", 'object_name': 'Word'},
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'lang_code': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['minerva.Language']"}),
+ 'level': ('django.db.models.fields.PositiveIntegerField', [], {}),
+ 'meaning': ('django.db.models.fields.TextField', [], {}),
+ 'sub_level': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
+ 'word': ('django.db.models.fields.CharField', [], {'max_length': '50'})
+ }
+ }
+
+ complete_apps = ['minerva']
View
12 minerva/models.py
@@ -40,6 +40,17 @@ def __unicode__(self):
def natural_key(self):
return (self.word, self.lang_code.code)
+class SessionProgress(models.Model):
+ """
+ Track some state for the current session
+ """
+ student = models.ForeignKey(a_models.User, null=True, blank=True)
+ anon_student = models.CharField(max_length=32, null=True, blank=True,
+ help_text="Anonymous users are tracked using their session key.")
+ word = models.ForeignKey(Word)
+
+ weight = models.IntegerField(default=0) # default weight of zero, we should check out this word!!
+ correct = models.IntegerField(default=0)
class Progress(models.Model):
"""
@@ -81,4 +92,3 @@ def __unicode__(self):
models.signals.post_save.connect(signal_handlers.create_user_profile,
sender=a_models.User)
-
Please sign in to comment.
Something went wrong with that request. Please try again.