From 244815c330b992fe97ed62dcc110e0b37a197358 Mon Sep 17 00:00:00 2001 From: Justin Xiao <94207497+jxiao21@users.noreply.github.com> Date: Fri, 19 Jul 2024 11:08:50 -0400 Subject: [PATCH] Fixes #1420: clean up names in models (#1586) * removed one word verbose names * added help text for name, start/end date, data last updated * chenged academic term verbose names * adding migration file: --- ..._alter_academicterms_canvas_id_and_more.py | 84 +++++++++++++++++++ dashboard/models.py | 28 +++---- 2 files changed, 98 insertions(+), 14 deletions(-) create mode 100644 dashboard/migrations/0028_alter_academicterms_canvas_id_and_more.py diff --git a/dashboard/migrations/0028_alter_academicterms_canvas_id_and_more.py b/dashboard/migrations/0028_alter_academicterms_canvas_id_and_more.py new file mode 100644 index 00000000..180b4411 --- /dev/null +++ b/dashboard/migrations/0028_alter_academicterms_canvas_id_and_more.py @@ -0,0 +1,84 @@ +# Generated by Django 4.2.11 on 2024-07-12 14:44 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('dashboard', '0027_remove_or_change_local_date_fields'), + ] + + operations = [ + migrations.AlterField( + model_name='academicterms', + name='canvas_id', + field=models.BigIntegerField(verbose_name='Academic Term Canvas Id'), + ), + migrations.AlterField( + model_name='academicterms', + name='date_end', + field=models.DateTimeField(blank=True, help_text='This field will be automatically populated by cron to match Canvas but can be adjusted if desired', null=True, verbose_name='End Date and Time'), + ), + migrations.AlterField( + model_name='academicterms', + name='date_start', + field=models.DateTimeField(blank=True, help_text='This field will be automatically populated by cron to match Canvas but can be adjusted if desired', null=True, verbose_name='Start Date and Time'), + ), + migrations.AlterField( + model_name='academicterms', + name='id', + field=models.BigIntegerField(primary_key=True, serialize=False, verbose_name='Academic Term Id'), + ), + migrations.AlterField( + model_name='academicterms', + name='name', + field=models.CharField(help_text='This field will be automatically populated by cron to match Canvas but can be adjusted if desired', max_length=255), + ), + migrations.AlterField( + model_name='assignment', + name='name', + field=models.CharField(default='', max_length=255), + ), + migrations.AlterField( + model_name='assignmentgroups', + name='name', + field=models.CharField(default='', max_length=255), + ), + migrations.AlterField( + model_name='assignmentgroups', + name='weight', + field=models.FloatField(blank=True, null=True), + ), + migrations.AlterField( + model_name='course', + name='data_last_updated', + field=models.DateTimeField(blank=True, help_text='This is the last time the cron was run and can be reset on the main courses page with the dropdown', null=True), + ), + migrations.AlterField( + model_name='course', + name='date_end', + field=models.DateTimeField(blank=True, help_text='This field will be automatically populated by cron to match Canvas but can be adjusted if desired', null=True, verbose_name='End Date and Time'), + ), + migrations.AlterField( + model_name='course', + name='date_start', + field=models.DateTimeField(blank=True, help_text='This field will be automatically populated by cron to match Canvas but can be adjusted if desired', null=True, verbose_name='Start Date and Time'), + ), + migrations.AlterField( + model_name='course', + name='name', + field=models.CharField(help_text='This field will be automatically populated by cron to match Canvas but can be adjusted if desired', max_length=255), + ), + migrations.AlterField( + model_name='course', + name='term', + field=models.ForeignKey(db_column='term_id', db_constraint=False, null=True, on_delete=django.db.models.deletion.SET_NULL, to='dashboard.academicterms'), + ), + migrations.AlterField( + model_name='submission', + name='score', + field=models.FloatField(blank=True, null=True), + ), + ] diff --git a/dashboard/models.py b/dashboard/models.py index a8cb00b1..917ed088 100644 --- a/dashboard/models.py +++ b/dashboard/models.py @@ -23,11 +23,11 @@ class AcademicTerms(models.Model): - id = models.BigIntegerField(primary_key=True, verbose_name="Term Id") - canvas_id = models.BigIntegerField(verbose_name="Canvas Id") - name = models.CharField(max_length=255, verbose_name="Name") - date_start = models.DateTimeField(verbose_name="Start Date and Time", blank=True, null=True) - date_end = models.DateTimeField(verbose_name="End Date and Time", blank=True, null=True) + id = models.BigIntegerField(primary_key=True, verbose_name="Academic Term Id") + canvas_id = models.BigIntegerField(verbose_name="Academic Term Canvas Id") + name = models.CharField(max_length=255, help_text="This field will be automatically populated by cron to match Canvas but can be adjusted if desired") + date_start = models.DateTimeField(verbose_name="Start Date and Time", blank=True, null=True, help_text="This field will be automatically populated by cron to match Canvas but can be adjusted if desired") + date_end = models.DateTimeField(verbose_name="End Date and Time", blank=True, null=True, help_text="This field will be automatically populated by cron to match Canvas but can be adjusted if desired") def __str__(self): return self.name @@ -97,7 +97,7 @@ class Meta: class Assignment(models.Model): id = models.BigIntegerField(primary_key=True, verbose_name="Assignment Id") - name = models.CharField(max_length=255, verbose_name="Name", default='') + name = models.CharField(max_length=255, default='') due_date = models.DateTimeField(blank=True, null=True, verbose_name="Due DateTime") points_possible = models.FloatField(blank=True, null=True, verbose_name="Points Possible") course_id = models.BigIntegerField(verbose_name="Course Id") @@ -112,8 +112,8 @@ class Meta: class AssignmentGroups(models.Model): id = models.BigIntegerField(primary_key=True, verbose_name="Assignment Group Id") - name = models.CharField(max_length=255, verbose_name="Name", default='') - weight = models.FloatField(blank=True, null=True, verbose_name="Weight") + name = models.CharField(max_length=255, default='') + weight = models.FloatField(blank=True, null=True) group_points = models.FloatField(blank=True, null=True, verbose_name="Group Points") course_id = models.BigIntegerField(verbose_name="Course Id") drop_lowest = models.IntegerField(blank=True, null=True, verbose_name="Drop Lowest") @@ -194,16 +194,16 @@ def get_data_earliest_date(self) -> Optional[datetime]: class Course(models.Model): id = models.BigIntegerField(primary_key=True, verbose_name="Course Id", db_column='id', editable=False) canvas_id = models.BigIntegerField(verbose_name="Canvas Course Id", db_column='canvas_id') - term = models.ForeignKey(AcademicTerms, verbose_name="Term", on_delete=models.SET_NULL, db_column="term_id", null=True, db_constraint=False) - name = models.CharField(max_length=255, verbose_name="Name") - date_start = models.DateTimeField(verbose_name="Start Date and Time", null=True, blank=True) - date_end = models.DateTimeField(verbose_name="End Date and Time", null=True, blank=True) + term = models.ForeignKey(AcademicTerms, on_delete=models.SET_NULL, db_column="term_id", null=True, db_constraint=False) + name = models.CharField(max_length=255, help_text="This field will be automatically populated by cron to match Canvas but can be adjusted if desired") + date_start = models.DateTimeField(verbose_name="Start Date and Time", null=True, blank=True, help_text="This field will be automatically populated by cron to match Canvas but can be adjusted if desired") + date_end = models.DateTimeField(verbose_name="End Date and Time", null=True, blank=True, help_text="This field will be automatically populated by cron to match Canvas but can be adjusted if desired") show_grade_counts = models.BooleanField(blank=False, null=False, default=False, verbose_name= "Show Grade Counts") GRADING_CHOICES = [('Percent', 'Percent'), ('Point', 'Point'), ] show_grade_type = models.CharField(verbose_name="Show Grade Type", max_length=255, choices=GRADING_CHOICES, default='Percent') - data_last_updated = models.DateTimeField(verbose_name="Data last updated", null=True, blank=True) + data_last_updated = models.DateTimeField(null=True, blank=True, help_text="This is the last time the cron was run and can be reset on the main courses page with the dropdown") date_created = models.DateTimeField(verbose_name="Date course was created", default=datetime.now, null=True, blank=True) objects = CourseQuerySet().as_manager() @@ -346,7 +346,7 @@ class Submission(models.Model): user_id = models.BigIntegerField(verbose_name="User Id") # Timestamp of when the submission was submitted. submitted_at = models.DateTimeField(blank=True, null=True, verbose_name="Submitted DateTime") - score = models.FloatField(blank=True, null=True, verbose_name="Score") + score = models.FloatField(blank=True, null=True) graded_date = models.DateTimeField(blank=True, null=True, verbose_name="Graded DateTime") # This is used for tracking of grade posted date and not used in Assignment view hence making it CharField grade_posted = models.DateTimeField(blank=True, null=True, verbose_name="Posted Grade DateTime")