Skip to content

Commit

Permalink
feat: add LearningAssistantCourseEnabled model to store course overri…
Browse files Browse the repository at this point in the history
…des (#48)

This commit adds a LearningAssistantCourseEnabled model to store overrides for whether the Learning Assistant feature is enabled. Although whether the feature is enabled will first be controlled by a CourseWaffleFlag, eventually, this model will allow course team members to selectively disable or re-enable the feature themselves.
  • Loading branch information
MichaelRoytman authored Jan 5, 2024
1 parent 23648dc commit 79c38b7
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Generated by Django 3.2.23 on 2024-01-04 15:02

from django.db import migrations, models
import django.utils.timezone
import model_utils.fields
import opaque_keys.edx.django.models


class Migration(migrations.Migration):

dependencies = [
('learning_assistant', '0004_remove_courseprompt_prompt'),
]

operations = [
migrations.CreateModel(
name='LearningAssistantCourseEnabled',
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')),
('course_id', opaque_keys.edx.django.models.CourseKeyField(db_index=True, max_length=255, unique=True)),
('enabled', models.BooleanField()),
],
options={
'abstract': False,
},
),
]
17 changes: 17 additions & 0 deletions learning_assistant/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,20 @@ def get_json_prompt_content_by_course_id(cls, course_id):
except cls.DoesNotExist:
json_prompt_content = None
return json_prompt_content


class LearningAssistantCourseEnabled(TimeStampedModel):
"""
This model stores whether the Learning Assistant is enabled for a particular course ID.
For now, the purpose of this model is to store overrides added by course team members. By default, the Learning
Assistant will be enabled via a CourseWaffleFlag. This model will store whether course team members have manually
disabled the Learning Assistant.
.. no_pii: This model has no PII.
"""

# course ID with for the course in which the Learning Assistant is enabled or disabled
course_id = CourseKeyField(max_length=255, db_index=True, unique=True)

enabled = models.BooleanField()

0 comments on commit 79c38b7

Please sign in to comment.