Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dropped Courses #2262

Open
wants to merge 21 commits into
base: main
Choose a base branch
from
Open

Dropped Courses #2262

wants to merge 21 commits into from

Conversation

fekoch
Copy link
Collaborator

@fekoch fekoch commented Aug 5, 2024

fixes #991

(@janno42) As discussed, we want:

  • A check-box "Allow drop-out?" when creating new evaluations
  • A setting "DROPOUT_QUESTIONNAIRE_ID" to set which questionnaire should be shown when using the drop-out function.
  • The "I dropped this course" button should be shown only on the student index and only for evaluations that "allow drop-out"
  • Show Dropout Questionnaire answers in Result UI
    • (only shown to people who can see general text answers)
  • Dropout questionnaire Textanswers should not be shown in the textanswer review

@fekoch fekoch force-pushed the 991/dropped-courses branch from 6545c8d to 9ea80f3 Compare August 5, 2024 18:55
@fekoch fekoch force-pushed the 991/dropped-courses branch 3 times, most recently from d91a83b to 2f42c54 Compare October 14, 2024 17:02
@fekoch fekoch force-pushed the 991/dropped-courses branch from 2f42c54 to e2e836e Compare October 14, 2024 19:07
@fekoch fekoch force-pushed the 991/dropped-courses branch from c24d5dd to 178fc31 Compare October 21, 2024 16:50
@fekoch fekoch force-pushed the 991/dropped-courses branch from 0c1711f to 2f3043b Compare October 28, 2024 17:07
@fekoch fekoch force-pushed the 991/dropped-courses branch 2 times, most recently from dc783bf to 96e9dc7 Compare November 11, 2024 17:09
@fekoch fekoch force-pushed the 991/dropped-courses branch 2 times, most recently from 1fa6eb3 to 5a312ec Compare November 25, 2024 18:31
@fekoch fekoch force-pushed the 991/dropped-courses branch 5 times, most recently from 2cb0daf to cfcf4fd Compare December 2, 2024 21:38
@fekoch fekoch force-pushed the 991/dropped-courses branch from cfcf4fd to 0f5c592 Compare December 16, 2024 18:19
@fekoch fekoch force-pushed the 991/dropped-courses branch 2 times, most recently from 9b73be5 to a88760b Compare January 13, 2025 17:47
@fekoch fekoch force-pushed the 991/dropped-courses branch from 9993ca6 to c89627a Compare January 20, 2025 17:40
@fekoch
Copy link
Collaborator Author

fekoch commented Jan 20, 2025

@janno42 New proposal: You can add drop-out-questionnaires for each evaluation, just like adding general questionnaires.

image

Simply by having at least one drop-out-questionnaire, the is_dropout_allowed-property is set on an evaluation and students can use the drop-out button in the UI.

A) Does this seem like a good idea?

and

B) Do we still need to have the whole "active-drop-out-questionnaire" logic if we implement it like that?

@fekoch fekoch force-pushed the 991/dropped-courses branch 2 times, most recently from 4933bf8 to b722b2d Compare January 27, 2025 17:11
@fekoch fekoch force-pushed the 991/dropped-courses branch from b722b2d to 9b1ca48 Compare January 27, 2025 21:20
@fekoch fekoch requested a review from janno42 February 17, 2025 18:34
Copy link
Member

@janno42 janno42 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the "Dropout Questionnaires" list in the contributor evaluation form is empty, the label should not be shown

@fekoch fekoch force-pushed the 991/dropped-courses branch from 952a2d1 to 7528c88 Compare February 24, 2025 16:23
@fekoch fekoch requested a review from janno42 February 24, 2025 18:43
@fekoch fekoch force-pushed the 991/dropped-courses branch from db7f3cc to 4427ab1 Compare February 24, 2025 19:15
@fekoch fekoch force-pushed the 991/dropped-courses branch from 4427ab1 to 727acca Compare February 24, 2025 20:16
Copy link
Member

@niklasmohrin niklasmohrin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't looked at results and staff yet, but here is what I have so far :)

Comment on lines +244 to +251
@property
def is_dropout_questionnaire(self):
return self.type == self.Type.DROPOUT

@property
def is_general_questionnaire(self):
return self.type in (self.Type.TOP, self.Type.BOTTOM)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since these are defined on Questionnaire, I suppose they could just be called is_dropout and is_general?

Comment on lines +140640 to +140641
"password": "pbkdf2_sha256$870000$FI1vp6JGLvZULamq2a9pIL$TLLlUbFnxARDpJFRmuL+gVR9QtFc9fxww/K7pM1PixM=",
"last_login": "2025-02-17T18:41:52.756",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you revert these, or does the CI fail then?

Comment on lines +213 to +215
def get_vote_page_form_groups(
request, evaluation: Evaluation, preview: bool, dropout=False
) -> OrderedDict[Contribution, list[QuestionnaireVotingForm]]:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that all methods with a dropout argument except vote itself should not have a default value. In fact, vote calls this function without passing its dropout value along, and I don't know if it's correct

@@ -255,31 +296,38 @@ def render_vote_page(request, evaluation, preview, for_rendering_in_modal=False)


@participant_required
def vote(request, evaluation_id): # noqa: PLR0912
def vote(request: HttpRequest, evaluation_id: int, dropout=False): # noqa: PLR0912
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def vote(request: HttpRequest, evaluation_id: int, dropout=False): # noqa: PLR0912
def vote(request: HttpRequest, evaluation_id: int, dropout=False) -> HttpResponse: # noqa: PLR0912

Comment on lines +62 to +63
<input id="{{ choice.id_for_label }}" class="tab-selectable num-selectable btn-check" name="{{ choice.data.name }}" type="radio" value="{{ choice.data.value }}" autocomplete="off"{% if field.initial == choice.data.value %} checked="checked"{% endif %}{% if preview %} disabled{% endif %}/>
<label for="{{ choice.id_for_label }}" class="btn btn-sm btn-light vote-btn vote-btn-{{ color }} d-flex{% if field.errors %} choice-error{% endif %}">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get the removal of active, but for the other changes I am puzzled - can you explain why you changed these?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

field.value was wrong, the value is stored in initial

Comment on lines +5 to +6
<form method="get" action="{% url 'student:drop' evaluation.id %}">
<confirmation-modal type="submit" confirm-button-class="btn-danger">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please indent :)

Suggested change
<form method="get" action="{% url 'student:drop' evaluation.id %}">
<confirmation-modal type="submit" confirm-button-class="btn-danger">
<form method="get" action="{% url 'student:drop' evaluation.id %}">
<confirmation-modal type="submit" confirm-button-class="btn-danger">

Comment on lines +296 to +298
for q in Questionnaire.objects.all():
q.visibility = Questionnaire.Visibility.MANAGERS
q.save()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
for q in Questionnaire.objects.all():
q.visibility = Questionnaire.Visibility.MANAGERS
q.save()
Questionnaire.objects.update(visibility=Questionnaire.Visibility.MANAGERS)

Comment on lines +312 to +313
self.assertContains(page, "General questionnaires")
self.assertContains(page, "Dropout Questionnaires")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a bit odd that "questionnaires" is capitalized for one option, but not for the other 🤔

selected_questionnaires |= self.cleaned_data.get("general_questionnaires").filter(is_locked=False)
selected_questionnaires |= self.cleaned_data.get("dropout_questionnaires").filter(is_locked=False)

self.cleaned_data.update(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find it a bit odd that we update the form values instead of throwing a ValidationError when things don't add up. In person, we discussed that we can leave it as is for this PR because it is the same behavior as before, but I think we should revisit this afterwards. What do you think @richardebeling @Kakadus ?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm. In that case the UI should probably prevent users from deselecting the button directly

Comment on lines +331 to +332
def test_choosing_dropout_sets_to_no_answer(self):
response = self.app.get(url=reverse("student:drop", args=[self.evaluation.id]), user=self.user, status=200)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose this test class would be better placed in the student app

Copy link
Member

@janno42 janno42 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • The dropout button on the student index page should be placed inline before the "Evaluate" button.
  • For the questions in the dropout questionnaire(s), no answers should be preselected.

selected_questionnaires |= self.cleaned_data.get("general_questionnaires").filter(is_locked=False)
selected_questionnaires |= self.cleaned_data.get("dropout_questionnaires").filter(is_locked=False)

self.cleaned_data.update(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm. In that case the UI should probably prevent users from deselecting the button directly

class QuestionnaireManager(Manager["Questionnaire"]):
def general_questionnaires(self) -> QuerySet["Questionnaire"]:
return (
super().get_queryset().exclude(type=Questionnaire.Type.CONTRIBUTOR).exclude(type=Questionnaire.Type.DROPOUT)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
super().get_queryset().exclude(type=Questionnaire.Type.CONTRIBUTOR).exclude(type=Questionnaire.Type.DROPOUT)
super().get_queryset().exclude(type__in=(Questionnaire.Type.CONTRIBUTOR, Questionnaire.Type.DROPOUT))

@@ -620,6 +639,10 @@ def runtime(self):
def is_in_evaluation_period(self):
return self.vote_start_datetime <= datetime.now() <= self.vote_end_datetime

@property
def is_dropout_allowed(self):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def is_dropout_allowed(self):
def is_dropout_allowed(self) -> bool:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Dropped courses
5 participants