From 7b807c33305284b7e6c061d29264230ff5df03e7 Mon Sep 17 00:00:00 2001 From: Antonio Quesada Date: Mon, 16 Oct 2023 20:08:24 -0700 Subject: [PATCH 1/2] overridden typo fix --- csm_web/scheduler/admin.py | 6 +++--- csm_web/scheduler/factories.py | 4 ++-- csm_web/scheduler/models.py | 6 +++--- csm_web/scheduler/serializers.py | 10 +++++----- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/csm_web/scheduler/admin.py b/csm_web/scheduler/admin.py index 4a64342f..23e94b37 100644 --- a/csm_web/scheduler/admin.py +++ b/csm_web/scheduler/admin.py @@ -895,11 +895,11 @@ class OverrideAdmin(BasePermissionModelAdmin): fields = ( "date", "spacetime", - "overriden_spacetime", + "overridden_spacetime", ) autocomplete_fields = ( "spacetime", - "overriden_spacetime", + "overridden_spacetime", ) list_filter = ( @@ -922,5 +922,5 @@ def get_old_spacetime(self, obj: Override): def get_new_spacetime(self, obj: Override): """Format link to new spacetime object.""" return get_admin_link_for( - obj.overriden_spacetime, "admin:scheduler_spacetime_change" + obj.overridden_spacetime, "admin:scheduler_spacetime_change" ) diff --git a/csm_web/scheduler/factories.py b/csm_web/scheduler/factories.py index 38ebddf3..69883e03 100644 --- a/csm_web/scheduler/factories.py +++ b/csm_web/scheduler/factories.py @@ -218,8 +218,8 @@ def date(self): date = evaluate_faker( factory.Faker( "date_between_dates", - date_start=self.overriden_spacetime.section.mentor.course.enrollment_start.date(), - date_end=self.overriden_spacetime.section.mentor.course.valid_until, + date_start=self.overridden_spacetime.section.mentor.course.enrollment_start.date(), + date_end=self.overridden_spacetime.section.mentor.course.valid_until, ) ) return date + timedelta( diff --git a/csm_web/scheduler/models.py b/csm_web/scheduler/models.py index 9e367ab6..ef91a021 100644 --- a/csm_web/scheduler/models.py +++ b/csm_web/scheduler/models.py @@ -528,14 +528,14 @@ class Override(ValidatingModel): spacetime = models.OneToOneField( Spacetime, on_delete=models.CASCADE, related_name="+" ) - overriden_spacetime = models.OneToOneField( + overridden_spacetime = models.OneToOneField( Spacetime, related_name="_override", on_delete=models.CASCADE ) date = models.DateField() def clean(self): super().clean() - if self.spacetime == self.overriden_spacetime: + if self.spacetime == self.overridden_spacetime: raise ValidationError("A spacetime cannot override itself") if self.spacetime.day_of_week != self.date.strftime("%A"): raise ValidationError( @@ -548,7 +548,7 @@ def is_expired(self): return self.date < now.date() def __str__(self): - return f"Override for {self.overriden_spacetime.section} : {self.spacetime}" + return f"Override for {self.overridden_spacetime.section} : {self.spacetime}" class Matcher(ValidatingModel): diff --git a/csm_web/scheduler/serializers.py b/csm_web/scheduler/serializers.py index cd31f741..9ef1e510 100644 --- a/csm_web/scheduler/serializers.py +++ b/csm_web/scheduler/serializers.py @@ -350,11 +350,11 @@ def create(self, validated_data): spacetime = Spacetime.objects.create( **validated_data["spacetime"], day_of_week=DayOfWeekField.DAYS[validated_data["date"].weekday()], - duration=validated_data["overriden_spacetime"].duration, + duration=validated_data["overridden_spacetime"].duration, ) return Override.objects.create( date=validated_data["date"], - overriden_spacetime=validated_data["overriden_spacetime"], + overridden_spacetime=validated_data["overridden_spacetime"], spacetime=spacetime, ) @@ -366,15 +366,15 @@ def update(self, instance, validated_data): ] instance.spacetime.location = spacetime_data["location"] instance.spacetime.start_time = spacetime_data["start_time"] - instance.spacetime.duration = instance.overriden_spacetime.duration + instance.spacetime.duration = instance.overridden_spacetime.duration instance.spacetime.save() instance.save() return instance class Meta: model = Override - fields = ("location", "start_time", "date", "overriden_spacetime") - extra_kwargs = {"overriden_spacetime": {"required": False}} + fields = ("location", "start_time", "date", "overridden_spacetime") + extra_kwargs = {"overridden_spacetime": {"required": False}} class MatcherSerializer(serializers.ModelSerializer): From abad2141cf554c435b7322c82ca7b20488480818 Mon Sep 17 00:00:00 2001 From: Antonio Quesada Date: Mon, 16 Oct 2023 20:26:43 -0700 Subject: [PATCH 2/2] second change to typo --- csm_web/scheduler/views/spacetime.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/csm_web/scheduler/views/spacetime.py b/csm_web/scheduler/views/spacetime.py index c96b169d..99106ed6 100644 --- a/csm_web/scheduler/views/spacetime.py +++ b/csm_web/scheduler/views/spacetime.py @@ -114,7 +114,7 @@ def override(self, request, pk=None): status_code = status.HTTP_202_ACCEPTED else: # create serializer = OverrideSerializer( - data={"overriden_spacetime": spacetime.pk, **request.data} + data={"overridden_spacetime": spacetime.pk, **request.data} ) status_code = status.HTTP_201_CREATED if serializer.is_valid():