Skip to content

Commit

Permalink
run precommit
Browse files Browse the repository at this point in the history
  • Loading branch information
fekoch committed Apr 29, 2024
1 parent 66a16a1 commit f3670fb
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
7 changes: 3 additions & 4 deletions evap/evaluation/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,8 +404,7 @@ class State(IntEnum):
}

state = FSMIntegerField(
default=State.NEW, choices=STATE_STR_CONVERSION.items(), protected=True,
verbose_name=_("state")
default=State.NEW, choices=STATE_STR_CONVERSION.items(), protected=True, verbose_name=_("state")
)

course = models.ForeignKey(Course, models.PROTECT, verbose_name=_("course"), related_name="evaluations")
Expand Down Expand Up @@ -461,7 +460,6 @@ class State(IntEnum):
)

class TextAnswerReviewState(Enum):
# TODO: replace with @enum_for_django_template decorator?
do_not_call_in_templates = True # pylint: disable=invalid-name
NO_TEXTANSWERS = auto()
NO_REVIEW_NEEDED = auto()
Expand Down Expand Up @@ -637,7 +635,7 @@ def can_reset_to_new(self):
"""Is it possible to execute .reset_to_new() for this evaluation?"""
return any(
state_transition.name == "reset_to_new" for state_transition in self.get_available_state_transitions()
) # type:ignore # get_available_<fieldname>_transitions() is available for all fsm-fields on a class
) # get_available_<fieldname>_transitions() is available for all fsm-fields on a class

@property
def can_be_edited_by_manager(self):
Expand Down Expand Up @@ -1026,6 +1024,7 @@ def unlogged_fields(self):
"_participant_count",
]


@receiver(post_transition, sender=Evaluation)
def evaluation_state_change(instance, source, **_kwargs):
"""Evaluation.save checks whether caches must be updated based on this value"""
Expand Down
3 changes: 1 addition & 2 deletions evap/evaluation/tests/test_models.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from datetime import date, datetime, timedelta
from unittest.mock import Mock, call, patch

from django.conf import settings
from django.contrib.auth.models import Group
from django.core import mail
from django.core.cache import caches
Expand Down Expand Up @@ -539,7 +538,7 @@ def test_textanswer_review_state(self):
evaluation.TextAnswerReviewState.REVIEWED,
)

def test_STATE_STR_CONVERSION_contains_all_states(self):
def test_state_str_conversion_contains_all_states(self):
for state in Evaluation.State:
self.assertIn(state, Evaluation.STATE_STR_CONVERSION)

Expand Down
3 changes: 2 additions & 1 deletion evap/staff/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
from django.test import override_settings
from django.test.testcases import TestCase
from django.urls import reverse
from django.utils import translation
from django_webtest import WebTest
from model_bakery import baker
from django.utils import translation

import evap.staff.fixtures.excel_files_test_data as excel_data
from evap.evaluation.models import (
Expand Down Expand Up @@ -2258,6 +2258,7 @@ def test_state_change_log_translated(self):
self.assertIn(new_de, page_de)
self.assertIn(prepared_de, page_de)


class TestEvaluationDeleteView(WebTestStaffMode):
csrf_checks = False
url = reverse("staff:evaluation_delete")
Expand Down

0 comments on commit f3670fb

Please sign in to comment.