-
Notifications
You must be signed in to change notification settings - Fork 147
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Positive and negative agreement (likert) questions (#1969)
* Fixes #1963 * Fixed old tests * Introduced new test * Applied black * questions/likert_questions [Refactor]: Solved Niklas comments * questions/negative_likert [Refactor]: Added tests * applied black * add warning for inverted answer scales * Fixed janno2 * Rebased * Finished+ * Isort * Rebased * BMBF * PR feedback * update test_data to include a question with a new type --------- Co-authored-by: FSadrieh <[email protected]> Co-authored-by: Johannes Wolf <[email protected]> Co-authored-by: Richard Ebeling <[email protected]> Co-authored-by: Niklas Mohrin <[email protected]>
- Loading branch information
1 parent
ad96350
commit e3c56c6
Showing
12 changed files
with
1,117 additions
and
53 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Generated by Django 4.2.3 on 2023-07-17 21:24 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("evaluation", "0139_userprofile_startpage"), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name="question", | ||
name="type", | ||
field=models.PositiveSmallIntegerField( | ||
choices=[ | ||
("Text", ((0, "Text question"),)), | ||
("Unipolar Likert", ((1, "Positive agreement question"), (12, "Negative agreement question"))), | ||
("Grade", ((2, "Grade question"),)), | ||
( | ||
"Bipolar Likert", | ||
( | ||
(6, "Easy-difficult question"), | ||
(7, "Few-many question"), | ||
(8, "Little-much question"), | ||
(9, "Small-large question"), | ||
(10, "Slow-fast question"), | ||
(11, "Short-long question"), | ||
), | ||
), | ||
("Yes-no", ((3, "Positive yes-no question"), (4, "Negative yes-no question"))), | ||
("Layout", ((5, "Heading"),)), | ||
], | ||
verbose_name="question type", | ||
), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ | |
from django_webtest import WebTest | ||
from model_bakery import baker | ||
|
||
from evap.evaluation.models import UserProfile | ||
from evap.evaluation.models import Evaluation, Question, QuestionType, UserProfile | ||
from evap.evaluation.tests.tools import WebTestWith200Check, create_evaluation_with_responsible_and_editor | ||
|
||
|
||
|
@@ -201,3 +201,31 @@ def test_edit_display_name(self): | |
|
||
page = self.app.get(self.url, user=self.responsible) | ||
self.assertContains(page, "testdisplayname") | ||
|
||
|
||
class TestNegativeLikertQuestions(WebTest): | ||
@classmethod | ||
def setUpTestData(cls): | ||
cls.voting_user = baker.make(UserProfile, email="[email protected]") | ||
|
||
cls.evaluation = baker.make( | ||
Evaluation, | ||
participants=[cls.voting_user], | ||
state=Evaluation.State.IN_EVALUATION, | ||
) | ||
|
||
cls.question = baker.make( | ||
Question, | ||
type=QuestionType.NEGATIVE_LIKERT, | ||
text_en="Negative Likert Question", | ||
text_de="Negative Likert Frage", | ||
) | ||
|
||
cls.evaluation.general_contribution.questionnaires.add(cls.question.questionnaire) | ||
|
||
cls.url = reverse("student:vote", args=[cls.evaluation.pk]) | ||
|
||
def test_answer_ordering(self): | ||
page = self.app.get(self.url, user=self.voting_user, status=200).body.decode() | ||
self.assertLess(page.index("Strongly<br>disagree"), page.index("Strongly<br>agree")) | ||
self.assertIn("The answer scale is inverted for this question", page) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.