Skip to content

Commit

Permalink
Fixup. Format code with Black
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions committed Jun 6, 2024
1 parent 05549df commit db093dd
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 17 deletions.
1 change: 1 addition & 0 deletions pod/completion/urls.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Esup-Pod Video completion urls."""

from django.conf.urls import url
from .views import video_completion
from .views import video_caption_maker
Expand Down
12 changes: 5 additions & 7 deletions pod/quiz/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,25 +48,23 @@ class QuestionForm(forms.Form):
}
),
required=False,
help_text=_("An explanation that will be displayed once the user has responded (feedback)."),
help_text=_(
"An explanation that will be displayed once the user has responded (feedback)."
),
)
start_timestamp = forms.IntegerField(
label=_("Start timestamp"),
required=False,
min_value=0,
widget=forms.NumberInput(attrs={"class": "start-timestamp-field"}),
help_text=_(
"The start time of the answer in the video (in seconds)."
),
help_text=_("The start time of the answer in the video (in seconds)."),
)
end_timestamp = forms.IntegerField(
label=_("End timestamp"),
required=False,
min_value=0,
widget=forms.NumberInput(attrs={"class": "end-timestamp-field"}),
help_text=_(
"The end time of the answer in the video (in seconds)."
),
help_text=_("The end time of the answer in the video (in seconds)."),
)
type = forms.ChoiceField(
choices=QUESTION_TYPES,
Expand Down
8 changes: 2 additions & 6 deletions pod/quiz/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,16 +97,12 @@ class Question(models.Model):
start_timestamp = models.PositiveIntegerField(
verbose_name=_("Start timestamp"),
null=True,
help_text=_(
"The start time of the answer in the video (in seconds)."
),
help_text=_("The start time of the answer in the video (in seconds)."),
)
end_timestamp = models.PositiveIntegerField(
verbose_name=_("End timestamp"),
null=True,
help_text=_(
"The end time of the answer in the video (in seconds)."
),
help_text=_("The end time of the answer in the video (in seconds)."),
)

class Meta:
Expand Down
4 changes: 3 additions & 1 deletion pod/quiz/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ def setUp(self) -> None:

def test_string_representation(self) -> None:
"""Test if test_string_representation works correctly."""
expected_string = f"{_('Question “%s”') % self.UCQ1.title} choices: {self.UCQ1.choices}"
expected_string = (
f"{_('Question “%s”') % self.UCQ1.title} choices: {self.UCQ1.choices}"
)
self.assertEqual(str(self.UCQ1), expected_string)
print(" ---> test_string_representation ok")

Expand Down
5 changes: 4 additions & 1 deletion pod/quiz/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,10 @@ def test_post_request_for_delete_quiz_view_valid_form(self) -> None:

self.assertEqual(response.status_code, 302)
self.assertRedirects(
response, reverse("video:completion:video_completion", kwargs={"slug": self.video.slug})
response,
reverse(
"video:completion:video_completion", kwargs={"slug": self.video.slug}
),
)
self.assertIn(_("The quiz has been deleted."), messages)
self.assertFalse(Quiz.objects.filter(video=self.video).exists())
Expand Down
8 changes: 6 additions & 2 deletions pod/quiz/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,9 @@ def update_questions(existing_quiz: Quiz, question_formset) -> None:
existing_question = get_question(question_type, question_id, existing_quiz)
if existing_question:
if not question_form.cleaned_data[question_type]:
raise ValidationError(_("No answer defined for question %s.") % question_id)
raise ValidationError(
_("No answer defined for question %s.") % question_id
)
update_question(existing_question, question_form.cleaned_data)
elif not question_form.cleaned_data.get("DELETE"):
create_question(
Expand Down Expand Up @@ -498,7 +500,9 @@ def delete_quiz(request: WSGIRequest, video_slug: str) -> HttpResponse:
if form.is_valid():
quiz.delete()
messages.add_message(request, messages.INFO, _("The quiz has been deleted."))
return redirect(reverse("video:completion:video_completion", kwargs={"slug": video.slug}))
return redirect(
reverse("video:completion:video_completion", kwargs={"slug": video.slug})
)
else:
messages.add_message(
request,
Expand Down

0 comments on commit db093dd

Please sign in to comment.