Skip to content

Commit

Permalink
feat: add LearningAssistantAuditTrial model (#132)
Browse files Browse the repository at this point in the history
* feat: add LearningAssistantAuditTrial model

* chore: Add no_pii annotation

* fix: make start_time non-nullable

* fix: also revise the migration

* fix: replace ghost tests/__init__.py
  • Loading branch information
ilee2u authored Nov 14, 2024
1 parent 08fdad2 commit e370923
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
31 changes: 31 additions & 0 deletions learning_assistant/migrations/0009_learningassistantaudittrial.py
Original file line number Diff line number Diff line change
@@ -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,
},
),
]
15 changes: 15 additions & 0 deletions learning_assistant/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

0 comments on commit e370923

Please sign in to comment.