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

WIP: JSON enrollment importer #2187

Draft
wants to merge 25 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
eb2b222
First steps with new JSON importer
hansegucker May 6, 2024
115d19e
[JSON import] Import lecturers
hansegucker May 6, 2024
814dbee
[JSON importer] Import courses and evaluations
hansegucker May 13, 2024
8508080
Use unique attribute for cms_id
hansegucker May 13, 2024
66e8f48
Clean up JSON import
hansegucker May 13, 2024
e4b0300
Import contributions from JSON
hansegucker May 13, 2024
cd7d40f
[JSON import] Don't import data for evaluations in approved state
hansegucker May 27, 2024
34b20dd
[JSON import] Create statistics during the import
hansegucker Jun 10, 2024
4914f98
[JSON import] Add log handler for email sending
hansegucker Jun 17, 2024
a886322
[JSON import] Add management command for import
hansegucker Jun 17, 2024
a6c8309
Fix log_exceptions to correctly pass args to handle
hansegucker Jun 17, 2024
0ce1464
Improve JSON importer code
hansegucker Jun 24, 2024
cc0f045
Refactor and optimize JSON importer
hansegucker Jul 1, 2024
5d2b213
Test management command for JSON import
hansegucker Jul 1, 2024
5ab1375
Remove test_data.json
hansegucker Jul 1, 2024
a8793e1
Fix problems with JSON importer tests
hansegucker Jul 1, 2024
f2da64c
[JSON importer] Also create name changes for lecturer changes
hansegucker Jul 8, 2024
2c23d53
Fix some code style issues
hansegucker Jul 29, 2024
2b3fa2c
Add cms_id to excluded fields in copy form
hansegucker Jul 29, 2024
315f7b2
Fix headings in JSON importer
hansegucker Aug 5, 2024
55a794c
Merge branch 'main' into json-enrollment-importer
hansegucker Oct 7, 2024
73fb0f7
Fix migrations and model names after merge (Degree to Program)
hansegucker Oct 7, 2024
e4d0ccc
[JSON importer] Send useful log email
hansegucker Oct 7, 2024
af64f84
Improve code style in JSON importer (tests)
hansegucker Oct 7, 2024
e90acf7
Merge branch 'main' into json-enrollment-importer
hansegucker Oct 14, 2024
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
2 changes: 1 addition & 1 deletion evap/evaluation/management/commands/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def log_exceptions(cls):
class NewClass(cls):
def handle(self, *args, **options):
try:
super().handle(args, options)
super().handle(*args, **options)
except Exception:
logger.exception("Management command '%s' failed. Traceback follows: ", sys.argv[1])
raise
Expand Down
27 changes: 27 additions & 0 deletions evap/evaluation/migrations/0143_course_cms_id_evaluation_cms_id.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Generated by Django 5.0.4 on 2024-05-13 20:59

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("evaluation", "0142_alter_evaluation_state"),
]

operations = [
migrations.AddField(
model_name="course",
name="cms_id",
field=models.CharField(
blank=True, max_length=255, null=True, unique=True, verbose_name="campus management system id"
),
),
migrations.AddField(
model_name="evaluation",
name="cms_id",
field=models.CharField(
blank=True, max_length=255, null=True, unique=True, verbose_name="campus management system id"
),
),
]
10 changes: 10 additions & 0 deletions evap/evaluation/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,11 @@ class Course(LoggedModel):
# grade publishers can set this to True, then the course will be handled as if final grades have already been uploaded
gets_no_grade_documents = models.BooleanField(verbose_name=_("gets no grade documents"), default=False)

# unique reference for import from campus management system
cms_id = models.CharField(
verbose_name=_("campus management system id"), blank=True, null=True, unique=True, max_length=255
)

class Meta:
unique_together = [
["semester", "name_de"],
Expand Down Expand Up @@ -444,6 +449,11 @@ class State:
verbose_name=_("wait for grade upload before publishing"), default=True
)

# unique reference for import from campus management system
cms_id = models.CharField(
verbose_name=_("campus management system id"), blank=True, null=True, unique=True, max_length=255
)

class TextAnswerReviewState(Enum):
do_not_call_in_templates = True # pylint: disable=invalid-name
NO_TEXTANSWERS = auto()
Expand Down
8 changes: 8 additions & 0 deletions evap/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,10 @@ class ManifestStaticFilesStorageWithJsReplacement(ManifestStaticFilesStorage):
"level": "ERROR",
"class": "django.utils.log.AdminEmailHandler",
},
"mail_managers": {
"level": "INFO",
"class": "evap.staff.log_handler.ManagerEmailHandler",
},
"console": {
"class": "logging.StreamHandler",
"formatter": "default",
Expand All @@ -202,6 +206,10 @@ class ManifestStaticFilesStorageWithJsReplacement(ManifestStaticFilesStorage):
"level": "DEBUG",
"propagate": True,
},
"import": {
"handlers": ["console", "file", "mail_managers"],
"level": "INFO",
},
},
}

Expand Down
Loading
Loading