Skip to content

Conversation

@janno42
Copy link
Member

@janno42 janno42 commented Jan 7, 2026

changes to courses and evaluations should only be made by the cms importer as long as they are in preparation

Copy link
Member

@richardebeling richardebeling left a comment

Choose a reason for hiding this comment

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

Change generally looks good to me, but I'm not yet convinced that we want to add the course to self.courses_by_gguid


if course and course.evaluations.exclude(state=Evaluation.State.NEW).exists():
self.statistics.attempted_course_changes.add(course)
self.courses_by_gguid[data["gguid"]] = course
Copy link
Member

Choose a reason for hiding this comment

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

In ~632, we have

            # Don't import if course was skipped
            course = self.courses_by_gguid.get(event["relatedevents"][0]["gguid"])
            if course is None:
                continue

Does adding the course to courses_by_gguid here make sense, given that this will make the logic below think the course was imported?

Copy link
Member Author

Choose a reason for hiding this comment

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

If we don't add it, no evaluations will be imported/updated for the course at all, which is not what we want. Here, no changes will be made to the course in the database, and the importer will continue processing the evaluations as usual.

Copy link
Member Author

Choose a reason for hiding this comment

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

Skipping is intended for course types that we don't want to import in the first place.

Copy link
Member

@niklasmohrin niklasmohrin Jan 7, 2026

Choose a reason for hiding this comment

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

can you add a short comment about this on the line here?

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.

looks good, except for what richard said

Comment on lines +714 to +718
importer = self._import()

evaluation = Evaluation.objects.get(pk=evaluation.pk)
self.assertFalse(evaluation.is_rewarded)
self.assertEqual(evaluation.course.name_en, "Change")
Copy link
Member

Choose a reason for hiding this comment

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

Does the following work, or does it also break because of #2576 ?

Suggested change
importer = self._import()
evaluation = Evaluation.objects.get(pk=evaluation.pk)
self.assertFalse(evaluation.is_rewarded)
self.assertEqual(evaluation.course.name_en, "Change")
with assert_no_database_modifications():
importer = self._import()

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, we have an empty log entry there

@janno42 janno42 merged commit 91d36aa into e-valuation:main Jan 9, 2026
15 checks passed
@janno42 janno42 deleted the importer-fix branch January 9, 2026 12:56
ZoqkMaze pushed a commit to ZoqkMaze/EvaP that referenced this pull request Jan 12, 2026
…n#2600)

changes to courses and evaluations should only be made by the cms
importer as long as they are in preparation
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.

3 participants