diff --git a/learning_assistant/migrations/0009_learningassistantaudittrial.py b/learning_assistant/migrations/0009_learningassistantaudittrial.py new file mode 100644 index 0000000..30068a2 --- /dev/null +++ b/learning_assistant/migrations/0009_learningassistantaudittrial.py @@ -0,0 +1,31 @@ +# Generated by Django 4.2.16 on 2024-11-14 13:55 + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion +import django.utils.timezone +import model_utils.fields + + +class Migration(migrations.Migration): + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ('learning_assistant', '0008_alter_learningassistantmessage_role'), + ] + + operations = [ + migrations.CreateModel( + name='LearningAssistantAuditTrial', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')), + ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')), + ('start_date', models.DateTimeField()), + ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, unique=True)), + ], + options={ + 'abstract': False, + }, + ), + ] diff --git a/learning_assistant/models.py b/learning_assistant/models.py index 482bfe2..bd05ceb 100644 --- a/learning_assistant/models.py +++ b/learning_assistant/models.py @@ -47,3 +47,18 @@ class LearningAssistantMessage(TimeStampedModel): user = models.ForeignKey(USER_MODEL, db_index=True, on_delete=models.CASCADE) role = models.CharField(choices=Roles, max_length=64) content = models.TextField() + + +class LearningAssistantAuditTrial(TimeStampedModel): + """ + This model stores the trial period for an audit learner using the learning assistant. + + A LearningAssistantAuditTrial instance will be created on a per user basis, + when an audit learner first sends a message using Xpert LA. + + .. no_pii: This model has no PII. + """ + + # Unique constraint since each user should only have one trial + user = models.ForeignKey(USER_MODEL, db_index=True, on_delete=models.CASCADE, unique=True) + start_date = models.DateTimeField()