Skip to content

Commit

Permalink
Fixes tl-its-umich-edu#1420: clean up names in models (tl-its-umich-e…
Browse files Browse the repository at this point in the history
…du#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:
  • Loading branch information
jxiao21 authored Jul 19, 2024
1 parent e58197a commit 244815c
Show file tree
Hide file tree
Showing 2 changed files with 98 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -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),
),
]
28 changes: 14 additions & 14 deletions dashboard/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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")
Expand All @@ -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")
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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")
Expand Down

0 comments on commit 244815c

Please sign in to comment.