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

Adds shortcut button to add exam evaluation #2050

Open
wants to merge 25 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added tests
  • Loading branch information
FSadrieh committed Apr 22, 2024
commit 69a7090e86d07e03b820efac265bfc500dc7a749
19 changes: 19 additions & 0 deletions evap/staff/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1959,6 +1959,25 @@ def test_create_exam_evaluation(self):
self.assertEqual(exam_evaluation.participants.count(), self.evaluation.participants.count())
FSadrieh marked this conversation as resolved.
Show resolved Hide resolved
self.assertEqual(exam_evaluation.weight, 1)
FSadrieh marked this conversation as resolved.
Show resolved Hide resolved

def test_exam_evaluation_for_single_result(self):
self.evaluation.is_single_result = True
self.evaluation.save()
self.app.post(self.url, user=self.manager, status=400, params={"evaluation_id": self.evaluation.pk})
self.assertFalse(self.evaluation.has_exam)

def test_exam_evaluation_for_already_existing_exam_evaluation(self):
baker.make(Evaluation, course=self.course, name_en="Exam", name_de="Klausur")
self.assertTrue(self.evaluation.has_exam)
self.app.post(self.url, user=self.manager, status=400, params={"evaluation_id": self.evaluation.pk})

def test_exam_evaluation_with_wrong_date(self):
self.evaluation.vote_start_datetime = datetime.datetime.now() + datetime.timedelta(days=100)
self.evaluation.vote_end_date = datetime.date.today() + datetime.timedelta(days=150)
self.evaluation.save()

self.app.post(self.url, user=self.manager, status=400, params={"evaluation_id": self.evaluation.pk})
self.assertFalse(self.evaluation.has_exam)
FSadrieh marked this conversation as resolved.
Show resolved Hide resolved


class TestCourseCopyView(WebTestStaffMode):
@classmethod
Expand Down
2 changes: 1 addition & 1 deletion evap/staff/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1060,7 +1060,7 @@ def create_exam_evaluation(request):
if evaluation.is_single_result:
raise SuspiciousOperation("Creating an exam evaluation for a single result evaluation is not allowed")

if evaluation.course.evaluations.filter(name_de="Klausur", name_en="Exam").exists():
if evaluation.has_exam:
raise SuspiciousOperation("An exam evaluation already exists for this course.")
FSadrieh marked this conversation as resolved.
Show resolved Hide resolved

evaluation_end_date = exam_date - timedelta(days=1)
Expand Down