Skip to content

Commit

Permalink
[wip] select default dropout
Browse files Browse the repository at this point in the history
  • Loading branch information
fekoch committed Oct 14, 2024
1 parent 8e867bf commit 2f42c54
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions evap/staff/templates/staff_questionnaire_index_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@
</div>
</td>
<td class="text-end">
{% if type == "dropout" %}
<!-- TODO@Felix: select default dropout
<a href="{% url 'staff:questionnaire_set_default_dropout' %}"></a>
{% endif %}
<a href="{% url 'staff:questionnaire_edit' questionnaire.id %}" class="btn btn-sm {%if questionnaire.can_be_edited_by_manager %}btn-primary{% else %}btn-light{% endif %}" data-bs-toggle="tooltip" data-bs-placement="top" title="{%if questionnaire.can_be_edited_by_manager %}{% translate 'Edit' %}{% else %}{% translate 'Edit (questionnaire is already in use)' %}{% endif %}"><span class="fas fa-pencil fa-fw"></span></a>
<a href="{% url 'staff:questionnaire_new_version' questionnaire.id %}" class="btn btn-sm btn-light" data-bs-toggle="tooltip" data-bs-placement="top" title="{% translate 'Hide and create new version' %}"><span class="fas fa-turn-up fa-fw fa-rotate-90"></span></a>
<a href="{% url 'staff:questionnaire_copy' questionnaire.id %}" class="btn btn-sm btn-light" data-bs-toggle="tooltip" data-bs-placement="top" title="{% translate 'Copy' %}"><span class="fas fa-copy fa-fw"></span></a>
Expand Down
1 change: 1 addition & 0 deletions evap/staff/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
path("questionnaire/update_indices", views.questionnaire_update_indices, name="questionnaire_update_indices"),
path("questionnaire/questionnaire_visibility", views.questionnaire_visibility, name="questionnaire_visibility"),
path("questionnaire/questionnaire_set_locked", views.questionnaire_set_locked, name="questionnaire_set_locked"),
path("questionnaire/<int:questionnaire_id>/set_default_dropout", views.questionnaire_set_default_dropout , name="questionnaire_set_default_dropout"),

path("programs/", views.ProgramIndexView.as_view(), name="program_index"),

Expand Down
9 changes: 9 additions & 0 deletions evap/staff/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1801,6 +1801,7 @@ def questionnaire_index(request):
prefetch_list = ("questions", "contributions__evaluation")
general_questionnaires = Questionnaire.objects.general_questionnaires().prefetch_related(*prefetch_list)
contributor_questionnaires = Questionnaire.objects.contributor_questionnaires().prefetch_related(*prefetch_list)
dropout_questionnaires = Questionnaire.objects.dropout_questionnaires().prefetch_related(*prefetch_list) # TODO@Felix: is prefetch related needed?

if filter_questionnaires:
general_questionnaires = general_questionnaires.exclude(visibility=Questionnaire.Visibility.HIDDEN)
Expand All @@ -1817,6 +1818,7 @@ def questionnaire_index(request):
"general_questionnaires_top": general_questionnaires_top,
"general_questionnaires_bottom": general_questionnaires_bottom,
"contributor_questionnaires": contributor_questionnaires,
"dropout_questionnaires": dropout_questionnaires,
"filter_questionnaires": filter_questionnaires,
}
return render(request, "staff_questionnaire_index.html", template_data)
Expand Down Expand Up @@ -2066,6 +2068,13 @@ def questionnaire_set_locked(request):
questionnaire.save()
return HttpResponse()

@require_POST
@manager_required
def questionnaire_set_default_dropout(request, questionnaire_id: int):
# TODO@Felix: implement setting new default
raise NotImplementedError



@manager_required
class ProgramIndexView(SuccessMessageMixin, SaveValidFormMixin, FormsetView):
Expand Down

0 comments on commit 2f42c54

Please sign in to comment.