Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
EdoStorm96 committed Jan 30, 2024
1 parent 91c509b commit caca593
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 22 deletions.
12 changes: 6 additions & 6 deletions main/templates/base/form_buttons.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,16 @@
{% if create_session %}
{% trans 'Opslaan en maak een nieuwe sessie aan >>' as create_session_text %}
<input class="button button-colored continue-button"
type="submit"
name="create_new_session"
value="{{ next_text|default:create_session_text }}" />
type="submit"
name="create_new_session"
value="{{ next_text|default:create_session_text }}" />
{% endif %}
{% if task %}
{% trans 'Opslaan en maak een nieuwe taak aan >>' as create_task_text %}
<input class="button button-colored continue-button"
type="submit"
name="create_new_task"
value="{{ next_text|default:create_task_text }}" />
type="submit"
name="create_new_task"
value="{{ next_text|default:create_task_text }}" />
{% endif %}
{% endif %}
{% if not no_forward %}
Expand Down
3 changes: 0 additions & 3 deletions proposals/utils/pdf_diff_logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -746,8 +746,6 @@ def get_row_fields(self):
return rows




class SessionSection(BaseSection):
"""This class receives a session object"""

Expand Down Expand Up @@ -1163,7 +1161,6 @@ def create_context_diff(context, old_proposal, new_proposal):
or new_study is not None
and new_study.has_sessions
):

old_sessions_set, new_sessions_set = get_all_related_set(
both_studies, "session_set"
)
Expand Down
1 change: 0 additions & 1 deletion proposals/utils/validate_proposal.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ def _build_forms(proposal: Proposal) -> OrderedDict:
)

if study.has_sessions:

for session in study.session_set.all():
session_start_key = "{}_session_{}_start".format(
key_base,
Expand Down
4 changes: 2 additions & 2 deletions studies/templates/studies/study_end.html
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,11 @@ <h4>{% trans "Takenonderzoek met de volgende opbouw:" %}</h4>
<div class="task_list mt-3">
<h5 class="pt-2">
Sessie {{ session.order }} (totale brutoduur: {{ session.tasks_duration }}
minuten, aantal herhalingen: {{session.repeats}})
minuten, aantal herhalingen: {{ session.repeats }})
<a href="{% url 'tasks:session_update' session.pk %}">
<img src="{% static 'proposals/images/pencil.png' %}"
title="{% trans 'Sessie verwijderen' %}">
</a>
</a>
{% if study.last_session.order > 1 %}
<a href="{% url 'tasks:session_delete' session.pk %}">
<img src="{% static 'proposals/images/delete.png' %}"
Expand Down
2 changes: 1 addition & 1 deletion tasks/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@


class SessionUpdateForm(SoftValidationMixin, ConditionalModelForm):

class Meta:
model = Session
fields = [
Expand Down Expand Up @@ -76,6 +75,7 @@ def clean(self):
cleaned_data, "supervision", "leader_has_coc", f1_value=False
)


class TaskForm(SoftValidationMixin, ConditionalModelForm):
class Meta:
model = Task
Expand Down
2 changes: 1 addition & 1 deletion tasks/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def net_duration(self):
return duration

return 0

def tasks_number(self):
return self.task_set.count()

Expand Down
10 changes: 5 additions & 5 deletions tasks/views/session_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,22 +43,22 @@ def delete(self, request, *args, **kwargs):
return HttpResponseRedirect(success_url)



##################
# Actions on Sessions
##################



class SessionCreate(RedirectActionView):

def action(self, request):
study = Study.objects.get(pk=self.kwargs["pk"])
order = study.session_set.count() + 1
self.session = Session.objects.create(order=order, study = study)
self.session = Session.objects.create(order=order, study=study)

def get_redirect_url(self, *args: Any, **kwargs: Any) -> str | None:
super().get_redirect_url(*args, **kwargs)
return reverse("tasks:session_update", args=[self.session.pk])


class SessionUpdate(AllowErrorsOnBackbuttonMixin, UpdateView):
"""Initial creation of Tasks for a Session"""

Expand Down Expand Up @@ -114,7 +114,7 @@ def get_form_kwargs(self):
pass

return kwargs

def get_success_url(self):
"""Sets the success_url based on the submit button pressed"""
if "create_new_session" in self.request.POST:
Expand Down
7 changes: 4 additions & 3 deletions tasks/views/task_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,18 @@
# CRUD actions on Task
######################


class TaskCreate(RedirectActionView):

def action(self, request):
session = Session.objects.get(pk=self.kwargs["pk"])
order = session.task_set.count() + 1
self.task = Task.objects.create(order=order, session = session)
self.task = Task.objects.create(order=order, session=session)

def get_redirect_url(self, *args, **kwargs):
super().get_redirect_url(*args, **kwargs)
return reverse("tasks:update", args=[self.task.pk])



class TaskUpdate(AllowErrorsOnBackbuttonMixin, UpdateView):
"""Updates a Task"""

Expand Down

0 comments on commit caca593

Please sign in to comment.