From 9b1c7c7bd9876f1bca731ba44af76318f5708ced Mon Sep 17 00:00:00 2001 From: Topvennie Date: Sat, 6 Apr 2024 11:06:37 +0200 Subject: [PATCH] chore: do todo's --- backend/api/locale/en/LC_MESSAGES/django.po | 60 +++++++------ backend/api/locale/nl/LC_MESSAGES/django.po | 60 +++++++------ .../api/migrations/0008_add_extra_checks.py | 32 ++----- .../migrations/0010_revise_extra_checks.py | 84 +++++++++++++++++++ backend/api/models/checks.py | 6 +- backend/api/models/submission.py | 3 +- backend/api/permissions/docker_permissions.py | 1 - .../api/permissions/project_permissions.py | 2 +- backend/api/serializers/checks_serializer.py | 12 ++- backend/api/signals.py | 5 +- backend/api/views/checks_view.py | 1 - backend/api/views/course_view.py | 2 +- backend/api/views/docker_view.py | 1 - backend/api/views/project_view.py | 5 +- backend/api/views/submission_view.py | 1 - backend/tmp.py | 5 -- backend/ypovoli/settings.py | 3 +- 17 files changed, 176 insertions(+), 107 deletions(-) create mode 100644 backend/api/migrations/0010_revise_extra_checks.py delete mode 100644 backend/tmp.py diff --git a/backend/api/locale/en/LC_MESSAGES/django.po b/backend/api/locale/en/LC_MESSAGES/django.po index e1968a4a..f9655e96 100644 --- a/backend/api/locale/en/LC_MESSAGES/django.po +++ b/backend/api/locale/en/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-04-04 15:08+0200\n" +"POT-Creation-Date: 2024-04-06 10:59+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -18,58 +18,66 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -#: helpers/check_folder_structure.py:141 +#: logic/check_folder_structure.py:142 msgid "zip.errors.invalid_structure.blocked_extension_found" msgstr "The submitted zip file contains a file with a non-allowed extension." -#: helpers/check_folder_structure.py:145 helpers/check_folder_structure.py:196 +#: logic/check_folder_structure.py:146 logic/check_folder_structure.py:197 msgid "zip.success" msgstr "The submitted zip file succeeds in all checks." -#: helpers/check_folder_structure.py:148 +#: logic/check_folder_structure.py:149 msgid "zip.errors.invalid_structure.obligated_extension_not_found" msgstr "" "The submitted zip file doesn't have any file with a certain file extension " "that's obligated." -#: helpers/check_folder_structure.py:175 +#: logic/check_folder_structure.py:176 msgid "zip.errors.invalid_structure.directory_not_defined" msgstr "An obligated directory was not found in the submitted zip file." -#: helpers/check_folder_structure.py:195 +#: logic/check_folder_structure.py:196 msgid "zip.errors.invalid_structure.directory_not_found_in_template" msgstr "" "There was a directory found in the submitted zip file, which was not asked " "for." -#: serializers/course_serializer.py:54 serializers/course_serializer.py:73 -#: serializers/course_serializer.py:92 serializers/course_serializer.py:111 +#: serializers/checks_serializer.py:61 +msgid "extra_check.error.docker_image" +msgstr "The field 'docker_image' is required." + +#: serializers/checks_serializer.py:65 +msgid "extra_check.error.timeout" +msgstr "The field 'timeout' cannot be greater than 1000." + +#: serializers/course_serializer.py:59 serializers/course_serializer.py:78 +#: serializers/course_serializer.py:97 serializers/course_serializer.py:116 msgid "courses.error.context" msgstr "The course is not supplied in the context." -#: serializers/course_serializer.py:60 tests/test_locale.py:28 +#: serializers/course_serializer.py:65 tests/test_locale.py:28 #: tests/test_locale.py:38 msgid "courses.error.students.already_present" msgstr "The student is already present in the course." -#: serializers/course_serializer.py:64 serializers/course_serializer.py:83 -#: serializers/course_serializer.py:102 serializers/course_serializer.py:121 +#: serializers/course_serializer.py:69 serializers/course_serializer.py:88 +#: serializers/course_serializer.py:107 serializers/course_serializer.py:126 msgid "courses.error.past_course" msgstr "The course is from a past year, thus cannot be manipulated." -#: serializers/course_serializer.py:79 +#: serializers/course_serializer.py:84 msgid "courses.error.students.not_present" msgstr "The student is not present in the course." -#: serializers/course_serializer.py:98 +#: serializers/course_serializer.py:103 msgid "courses.error.teachers.already_present" msgstr "The teacher is already present in the course." -#: serializers/course_serializer.py:117 +#: serializers/course_serializer.py:122 msgid "courses.error.teachers.not_present" msgstr "The teacher is not present in the course." -#: serializers/docker_serializer.py:21 +#: serializers/docker_serializer.py:19 msgid "docker.errors.custom" msgstr "User is not allowed to create public images" @@ -142,35 +150,35 @@ msgstr "The submission was successfully added to the group." msgid "admins.success.add" msgstr "The admin was successfully added." -#: views/course_view.py:45 +#: views/course_view.py:48 msgid "courses.success.create" msgstr "The course was successfully created." -#: views/course_view.py:80 +#: views/course_view.py:112 msgid "courses.success.assistants.add" msgstr "The assistant was successfully added to the course." -#: views/course_view.py:100 +#: views/course_view.py:132 msgid "courses.success.assistants.remove" msgstr "The assistant was successfully removed from the course." -#: views/course_view.py:135 +#: views/course_view.py:167 msgid "courses.success.students.add" msgstr "The student was successfully added to the course." -#: views/course_view.py:156 +#: views/course_view.py:188 msgid "courses.success.students.remove" msgstr "The student was successfully removed from the course." -#: views/course_view.py:191 +#: views/course_view.py:223 msgid "courses.success.teachers.add" msgstr "The teacher was successfully added to the course." -#: views/course_view.py:212 +#: views/course_view.py:244 msgid "courses.success.teachers.remove" msgstr "The teacher was successfully removed from the course." -#: views/course_view.py:248 +#: views/course_view.py:280 msgid "course.success.project.add" msgstr "The project was successfully added to the course." @@ -182,14 +190,14 @@ msgstr "The student was successfully added to the group." msgid "group.success.students.remove" msgstr "The student was successfully removed from the group." -#: views/project_view.py:86 +#: views/project_view.py:87 msgid "project.success.groups.created" msgstr "A group was successfully created for the project." -#: views/project_view.py:124 +#: views/project_view.py:125 msgid "project.success.structure_check.add" msgstr "A strucure check was successfully created for the project." -#: views/project_view.py:159 +#: views/project_view.py:161 msgid "project.success.extra_check.add" msgstr "The extra check check was successfully added to the project." diff --git a/backend/api/locale/nl/LC_MESSAGES/django.po b/backend/api/locale/nl/LC_MESSAGES/django.po index a882e217..3aecee6d 100644 --- a/backend/api/locale/nl/LC_MESSAGES/django.po +++ b/backend/api/locale/nl/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-04-04 15:08+0200\n" +"POT-Creation-Date: 2024-04-06 10:59+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -18,58 +18,66 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -#: helpers/check_folder_structure.py:141 +#: logic/check_folder_structure.py:142 msgid "zip.errors.invalid_structure.blocked_extension_found" msgstr "" "Bestanden met een verboden extensie zijn gevonden in het ingediende zip-" "bestand." -#: helpers/check_folder_structure.py:145 helpers/check_folder_structure.py:196 +#: logic/check_folder_structure.py:146 logic/check_folder_structure.py:197 msgid "zip.success" msgstr "Het zip-bestand van de indiening bevat alle benodigde bestanden." -#: helpers/check_folder_structure.py:148 +#: logic/check_folder_structure.py:149 msgid "zip.errors.invalid_structure.obligated_extension_not_found" msgstr "" "Er is geen enkel bestand met een bepaalde extensie die verplicht is in het " "ingediende zip-bestand." -#: helpers/check_folder_structure.py:175 +#: logic/check_folder_structure.py:176 msgid "zip.errors.invalid_structure.directory_not_defined" msgstr "Een verplichte map is niet aanwezig in het ingediende zip-bestand." -#: helpers/check_folder_structure.py:195 +#: logic/check_folder_structure.py:196 msgid "zip.errors.invalid_structure.directory_not_found_in_template" msgstr "Het ingediende zip-bestand bevat een map die niet gevraagd is." -#: serializers/course_serializer.py:54 serializers/course_serializer.py:73 -#: serializers/course_serializer.py:92 serializers/course_serializer.py:111 +#: serializers/checks_serializer.py:61 +msgid "extra_check.error.docker_image" +msgstr "Het veld 'docker_image' is vereist." + +#: serializers/checks_serializer.py:65 +msgid "extra_check.error.timeout" +msgstr "Het veld 'timeout' mag niet groter zijn dan 1000" + +#: serializers/course_serializer.py:59 serializers/course_serializer.py:78 +#: serializers/course_serializer.py:97 serializers/course_serializer.py:116 msgid "courses.error.context" msgstr "De opleiding is niet meegeleverd als context." -#: serializers/course_serializer.py:60 tests/test_locale.py:28 +#: serializers/course_serializer.py:65 tests/test_locale.py:28 #: tests/test_locale.py:38 msgid "courses.error.students.already_present" msgstr "De student bevindt zich al in de opleiding." -#: serializers/course_serializer.py:64 serializers/course_serializer.py:83 -#: serializers/course_serializer.py:102 serializers/course_serializer.py:121 +#: serializers/course_serializer.py:69 serializers/course_serializer.py:88 +#: serializers/course_serializer.py:107 serializers/course_serializer.py:126 msgid "courses.error.past_course" msgstr "De opleiding die men probeert te manipuleren is van een vorig jaar." -#: serializers/course_serializer.py:79 +#: serializers/course_serializer.py:84 msgid "courses.error.students.not_present" msgstr "De student bevindt zich niet in de opleiding." -#: serializers/course_serializer.py:98 +#: serializers/course_serializer.py:103 msgid "courses.error.teachers.already_present" msgstr "De lesgever bevindt zich al in de opleiding." -#: serializers/course_serializer.py:117 +#: serializers/course_serializer.py:122 msgid "courses.error.teachers.not_present" msgstr "De lesgever bevindt zich niet in de opleiding." -#: serializers/docker_serializer.py:21 +#: serializers/docker_serializer.py:19 msgid "docker.errors.custom" msgstr "Gebruiker is niet toegelaten om publieke afbeeldingen te maken" @@ -143,35 +151,35 @@ msgstr "De indiening is succesvol toegevoegd aan de groep." msgid "admins.success.add" msgstr "De admin is successvol toegevoegd." -#: views/course_view.py:45 +#: views/course_view.py:48 msgid "courses.success.create" msgstr "het vak is succesvol aangemaakt." -#: views/course_view.py:80 +#: views/course_view.py:112 msgid "courses.success.assistants.add" msgstr "De assistent is succesvol toegevoegd aan de opleiding." -#: views/course_view.py:100 +#: views/course_view.py:132 msgid "courses.success.assistants.remove" msgstr "De assistent is succesvol verwijderd uit de opleiding." -#: views/course_view.py:135 +#: views/course_view.py:167 msgid "courses.success.students.add" msgstr "De student is succesvol toegevoegd aan de opleiding." -#: views/course_view.py:156 +#: views/course_view.py:188 msgid "courses.success.students.remove" msgstr "De student is succesvol verwijderd uit de opleiding." -#: views/course_view.py:191 +#: views/course_view.py:223 msgid "courses.success.teachers.add" msgstr "De lesgever is succesvol toegevoegd aan de opleiding." -#: views/course_view.py:212 +#: views/course_view.py:244 msgid "courses.success.teachers.remove" msgstr "De lesgever is succesvol verwijderd uit de opleiding." -#: views/course_view.py:248 +#: views/course_view.py:280 msgid "course.success.project.add" msgstr "Het project is succesvol toegevoegd aan de opleiding." @@ -183,14 +191,14 @@ msgstr "De student is succesvol toegevoegd aan de groep." msgid "group.success.students.remove" msgstr "De student is succesvol verwijderd uit de groep." -#: views/project_view.py:86 +#: views/project_view.py:87 msgid "project.success.groups.created" msgstr "De groep is succesvol toegevoegd aan het project." -#: views/project_view.py:124 +#: views/project_view.py:125 msgid "project.success.structure_check.add" msgstr "De structuur check is succesvol toegevoegd aan het project." -#: views/project_view.py:159 +#: views/project_view.py:161 msgid "project.success.extra_check.add" msgstr "De extra check is succesvol toegevoegd aan het project." diff --git a/backend/api/migrations/0008_add_extra_checks.py b/backend/api/migrations/0008_add_extra_checks.py index bc8f8582..81440923 100644 --- a/backend/api/migrations/0008_add_extra_checks.py +++ b/backend/api/migrations/0008_add_extra_checks.py @@ -1,11 +1,6 @@ -from api.logic.get_file_path import (get_docker_image_file_path, - get_extra_check_file_path, - get_extra_check_result_file_path, - get_submission_file_path) from django.db import migrations, models -# TODO: Move changes to new file, ER, db class Migration(migrations.Migration): dependencies = [ @@ -18,10 +13,8 @@ class Migration(migrations.Migration): fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('name', models.CharField(max_length=256, blank=False, null=False)), - ('file', models.FileField(upload_to=get_docker_image_file_path, max_length=256, blank=False, null=False)), - ('owner', models.ForeignKey(to="authentication.user", on_delete=models.SET_NULL, - related_name="docker_images", blank=False, null=True)), - ('public', models.BooleanField(default=False, blank=False, null=False)), + ('file_path', models.FileField(upload_to="docker_images", max_length=256, blank=False, null=False)), + ('custom', models.BooleanField(default=False, blank=False, null=False)), ] ), migrations.CreateModel( @@ -37,14 +30,13 @@ class Migration(migrations.Migration): ), migrations.AddField( model_name="extracheck", - name="docker_image", - field=models.ForeignKey(to="api.dockerimage", on_delete=models.CASCADE, - related_name="extra_checks", blank=False, null=False), + name="docker_image_id", + field=models.ForeignKey(to="api.dockerimage", on_delete=models.CASCADE, related_name="extra_checks"), ), migrations.AddField( model_name="extracheck", - name="file", - field=models.FileField(upload_to=get_extra_check_file_path, max_length=256, blank=False, null=False) + name="file_path", + field=models.CharField(max_length=256, blank=False, null=False) ), migrations.AddField( model_name="extracheck", @@ -65,16 +57,6 @@ class Migration(migrations.Migration): migrations.AddField( model_name="extrachecksresult", name="log_file", - field=models.FileField(upload_to=get_extra_check_result_file_path, max_length=256, blank=False, null=True) - ), - migrations.AddField( - model_name="extrachecksresult", - name="is_valid", - field=models.BooleanField(default=True, blank=False, null=False) - ), - migrations.AlterField( - model_name="submissionfile", - name="file", - field=models.FileField(upload_to=get_submission_file_path, max_length=265, blank=False, null=False) + field=models.CharField(max_length=256, blank=False, null=True) ) ] diff --git a/backend/api/migrations/0010_revise_extra_checks.py b/backend/api/migrations/0010_revise_extra_checks.py new file mode 100644 index 00000000..bc9b80f9 --- /dev/null +++ b/backend/api/migrations/0010_revise_extra_checks.py @@ -0,0 +1,84 @@ +from api.logic.get_file_path import (get_docker_image_file_path, + get_extra_check_file_path, + get_extra_check_result_file_path, + get_submission_file_path) +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('api', '0009_merge_0008_add_extra_checks_0008_course_faculty'), + ] + + operations = [ + migrations.RemoveField( + model_name="dockerimage", + name="file_path" + ), + migrations.RemoveField( + model_name="dockerimage", + name="custom" + ), + migrations.AddField( + model_name="dockerimage", + name="file", + field=models.FileField(upload_to=get_docker_image_file_path, max_length=256, blank=False, null=False) + ), + migrations.AddField( + model_name="dockerimage", + name="owner", + field=models.ForeignKey(to="authentication.user", on_delete=models.SET_NULL, + related_name="docker_images", blank=False, null=True) + ), + migrations.AddField( + model_name="dockerimage", + name="public", + field=models.BooleanField(default=False, blank=False, null=False) + ), + migrations.RemoveField( + model_name="extracheck", + name="docker_image_id" + ), + migrations.AddField( + model_name="extracheck", + name="docker_image", + field=models.ForeignKey(to="api.dockerimage", on_delete=models.CASCADE, + related_name="extra_checks", blank=False, null=False) + ), + migrations.RemoveField( + model_name="extracheck", + name="file_path" + ), + migrations.AddField( + model_name="extracheck", + name="file", + field=models.FileField(upload_to=get_extra_check_file_path, max_length=256, blank=False, null=False) + ), + migrations.AlterField( + model_name="extracheck", + name="timeout", + field=models.PositiveSmallIntegerField(default=60, blank=False, null=False) + ), + migrations.AlterField( + model_name="extrachecksresult", + name="error_message", + field=models.ForeignKey(to="api.errortemplate", on_delete=models.SET_NULL, + related_name="extra_checks_results", blank=True, null=True) + ), + migrations.AlterField( + model_name="extrachecksresult", + name="log_file", + field=models.FileField(upload_to=get_extra_check_result_file_path, max_length=256, blank=False, null=True) + ), + migrations.AddField( + model_name="extrachecksresult", + name="is_valid", + field=models.BooleanField(default=True, blank=False, null=False) + ), + migrations.AlterField( + model_name="submissionfile", + name="file", + field=models.FileField(upload_to=get_submission_file_path, max_length=265, blank=False, null=False) + ) + ] diff --git a/backend/api/models/checks.py b/backend/api/models/checks.py index 5abf3246..bfb0b6a4 100644 --- a/backend/api/models/checks.py +++ b/backend/api/models/checks.py @@ -79,9 +79,8 @@ class ExtraCheck(models.Model): ) # Maximum time the script can run for - # TODO: Set a max of 1000 seconds - timeout = models.SmallIntegerField( - default=300, + timeout = models.PositiveSmallIntegerField( + default=60, blank=False, null=False ) @@ -97,7 +96,6 @@ class ExtraCheck(models.Model): @receiver(post_save, sender=ExtraCheck) @receiver(pre_delete, sender=ExtraCheck) def run_checks(sender, instance: ExtraCheck, **kwargs): - # TODO: Use querysets for group in instance.project.groups.all(): submissions = group.submissions.order_by("submission_time") if submissions: diff --git a/backend/api/models/submission.py b/backend/api/models/submission.py index 974f9e23..d8e9f44e 100644 --- a/backend/api/models/submission.py +++ b/backend/api/models/submission.py @@ -35,7 +35,6 @@ class Submission(models.Model): default=False ) - # TODO: Does this matter? Submission number should be assigned in the backend class Meta: # A group can only have one submission with a specific number unique_together = ("group", "submission_number") @@ -46,7 +45,7 @@ def run_checks(sender, instance: Submission, **kwargs): run_extra_checks.send(sender=Submission, submission=instance) -# TODO: Why a different class? +# TODO: We can use a FilePathField for this with allow_files = False and allow_folders = True and include it in Submission class SubmissionFile(models.Model): """Model for a file that is part of a submission.""" diff --git a/backend/api/permissions/docker_permissions.py b/backend/api/permissions/docker_permissions.py index 24e78438..7f0dc2dd 100644 --- a/backend/api/permissions/docker_permissions.py +++ b/backend/api/permissions/docker_permissions.py @@ -6,7 +6,6 @@ from rest_framework.viewsets import ViewSet -# TODO: Types class DockerPermission(BasePermission): def has_permission(self, request: Request, view: ViewSet) -> bool: user: User = request.user diff --git a/backend/api/permissions/project_permissions.py b/backend/api/permissions/project_permissions.py index 132d7d93..55ff054a 100644 --- a/backend/api/permissions/project_permissions.py +++ b/backend/api/permissions/project_permissions.py @@ -13,7 +13,7 @@ def has_permission(self, request: Request, view: ViewSet) -> bool: """Check if user has permission to view a general project endpoint.""" user: User = request.user - # TODO: but you return true + # TODO: Sure return True corresponds with the comments made above # The general project endpoint that lists all projects is not accessible for any role. if request.method in SAFE_METHODS: return True diff --git a/backend/api/serializers/checks_serializer.py b/backend/api/serializers/checks_serializer.py index b6386545..b16fd4f4 100644 --- a/backend/api/serializers/checks_serializer.py +++ b/backend/api/serializers/checks_serializer.py @@ -1,6 +1,7 @@ from api.models.checks import ExtraCheck, StructureCheck from api.models.docker import DockerImage from api.models.extension import FileExtension +from django.utils.translation import gettext as _ from rest_framework import serializers @@ -53,9 +54,12 @@ class Meta: def validate(self, attrs): data = super().validate(attrs) - # TODO: Doesn't allow PATCH - if "docker_image" not in data: - # TODO: translation - raise serializers.ValidationError("docker_image is required") + # Only check if docker image is present when it is not a partial update + if not self.partial: + if "docker_image" not in data: + raise serializers.ValidationError(_("extra_check.error.docker_image")) + + if "timeout" in data and data["timeout"] > 1000: + raise serializers.ValidationError(_("extra_check.error.timeout")) return data diff --git a/backend/api/signals.py b/backend/api/signals.py index c58d36db..f6e2ddc5 100644 --- a/backend/api/signals.py +++ b/backend/api/signals.py @@ -3,7 +3,7 @@ from django.dispatch import Signal, receiver -# TODO: Signal? +# TODO: Is this a signal? def user_creation(user: User, attributes: dict, **_): """Upon user creation, auto-populate additional properties""" student_id: str = attributes.get("ugentStudentID") @@ -17,7 +17,6 @@ def user_creation(user: User, attributes: dict, **_): @receiver(run_extra_checks) def _run_extra_checks(submission, **kwargs): - # TODO: Set all previous submissions to invalid - # TODO: Run extra checks + # TODO: Actually run the checks print("Running extra checks", flush=True) return True diff --git a/backend/api/views/checks_view.py b/backend/api/views/checks_view.py index 1eb0f485..b96bd8f7 100644 --- a/backend/api/views/checks_view.py +++ b/backend/api/views/checks_view.py @@ -16,7 +16,6 @@ class StructureCheckViewSet(viewsets.ModelViewSet): serializer_class = StructureCheckSerializer -# TODO: Set result to invalid for all submission but the newest class ExtraCheckViewSet(RetrieveModelMixin, UpdateModelMixin, DestroyModelMixin, viewsets.GenericViewSet): queryset = ExtraCheck.objects.all() serializer_class = ExtraCheckSerializer diff --git a/backend/api/views/course_view.py b/backend/api/views/course_view.py index 5951a02f..297401b9 100644 --- a/backend/api/views/course_view.py +++ b/backend/api/views/course_view.py @@ -32,7 +32,7 @@ class CourseViewSet(viewsets.ModelViewSet): serializer_class = CourseSerializer permission_classes = [IsAdminUser | CoursePermission] - # TODO: Creating should return the info of the new object and now a message "created" + # TODO: Creating should return the info of the new object and not a message "created" (General TODO) def create(self, request: Request, *_): """Override the create method to add the teacher to the course""" serializer = CourseSerializer(data=request.data, context={"request": request}) diff --git a/backend/api/views/docker_view.py b/backend/api/views/docker_view.py index e081f4e2..769de796 100644 --- a/backend/api/views/docker_view.py +++ b/backend/api/views/docker_view.py @@ -13,7 +13,6 @@ from rest_framework.viewsets import GenericViewSet -# TODO: Add to urls.py class DockerImageViewSet(RetrieveModelMixin, CreateModelMixin, UpdateModelMixin, DestroyModelMixin, GenericViewSet): queryset = DockerImage.objects.all() diff --git a/backend/api/views/project_view.py b/backend/api/views/project_view.py index 74d68da3..06a4c1df 100644 --- a/backend/api/views/project_view.py +++ b/backend/api/views/project_view.py @@ -22,7 +22,7 @@ from rest_framework.viewsets import GenericViewSet -# TODO: Error message when creating a project with wrongly formatted date is weird +# TODO: Error message when creating a project with wrongly formatted date looks a bit weird class ProjectViewSet(CreateModelMixin, RetrieveModelMixin, UpdateModelMixin, @@ -117,7 +117,6 @@ def _add_structure_check(self, request: Request, **_): } ) - # TODO: Raise exception gaat hier geen response geven smh if serializer.is_valid(raise_exception=True): serializer.save(project=project) @@ -137,8 +136,6 @@ def extra_checks(self, request, **_): ) return Response(serializer.data) - # TODO: Run all docker checks and send notification to submissions guys if not success - # TODO: Set result to invalid for all submission but the newest @extra_checks.mapping.post @swagger_auto_schema(request_body=ExtraCheckSerializer) def _add_extra_check(self, request: Request, **_): diff --git a/backend/api/views/submission_view.py b/backend/api/views/submission_view.py index 2dc562a6..3769183e 100644 --- a/backend/api/views/submission_view.py +++ b/backend/api/views/submission_view.py @@ -9,7 +9,6 @@ class SubmissionFileViewSet(viewsets.ModelViewSet): queryset = SubmissionFile.objects.all() serializer_class = SubmissionFileSerializer -# TODO: Run docker tests when new submission if extra checks class SubmissionViewSet(viewsets.ModelViewSet): queryset = Submission.objects.all() diff --git a/backend/tmp.py b/backend/tmp.py deleted file mode 100644 index d95e1739..00000000 --- a/backend/tmp.py +++ /dev/null @@ -1,5 +0,0 @@ -def admin(): - from authentication.models import User - a = User.objects.get(username='vvallaey') - a.is_staff = True - a.save() diff --git a/backend/ypovoli/settings.py b/backend/ypovoli/settings.py index 8fae7083..f136aad2 100644 --- a/backend/ypovoli/settings.py +++ b/backend/ypovoli/settings.py @@ -89,8 +89,7 @@ # Application endpoints PORT = environ.get("DJANGO_CAS_PORT", "8080") CAS_ENDPOINT = "https://login.ugent.be" -# TODO: Change back (remove api) -CAS_RESPONSE = f"https://{DOMAIN_NAME}:{PORT}/api/auth/verify" +CAS_RESPONSE = f"https://{DOMAIN_NAME}:{PORT}/auth/verify" CAS_DEBUG_RESPONSE = f"https://{DOMAIN_NAME}:{PORT}/api/auth/cas/echo" API_ENDPOINT = f"https://{DOMAIN_NAME}/api"