diff --git a/backend/api/fixtures/realistic/realistic.yaml b/backend/api/fixtures/realistic/realistic.yaml index 5c3fcaf3..f7664d29 100644 --- a/backend/api/fixtures/realistic/realistic.yaml +++ b/backend/api/fixtures/realistic/realistic.yaml @@ -33,7 +33,7 @@ visible: true archived: false locked_groups: false - start_date: 2024-12-12T00:00:00Z + start_date: 2023-12-12T00:00:00Z deadline: 2025-01-01T00:00:00Z max_score: 100 score_visible: false @@ -134,9 +134,18 @@ project: 0 obligated_extensions: - 0 - blocked_extensions: [] + blocked_extensions: + - 1 - model: api.structurecheck pk: 1 + fields: + path: "verslag/" + project: 0 + obligated_extensions: + - 3 + blocked_extensions: [] +- model: api.structurecheck + pk: 2 fields: path: src/ project: 1 @@ -145,7 +154,7 @@ blocked_extensions: - 2 - model: api.structurecheck - pk: 2 + pk: 3 fields: path: verslag/ project: 1 @@ -153,7 +162,7 @@ - 3 blocked_extensions: [] - model: api.structurecheck - pk: 3 + pk: 4 fields: path: "" project: 3 diff --git a/backend/api/locale/en/LC_MESSAGES/django.po b/backend/api/locale/en/LC_MESSAGES/django.po index 9015d015..c481af8c 100755 --- 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-05-15 19:49+0200\n" +"POT-Creation-Date: 2024-05-20 12:24+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -188,39 +188,43 @@ msgstr "The student is already in the group." msgid "group.errors.not_present" msgstr "The student is currently not in the group." -#: serializers/project_serializer.py:22 +#: serializers/project_serializer.py:23 msgid "project.errors.invalid_instance" msgstr "Error while parsing the provided zip." -#: serializers/project_serializer.py:81 +#: serializers/project_serializer.py:122 msgid "project.errors.context" msgstr "The project is not supplied in the context." -#: serializers/project_serializer.py:86 +#: serializers/project_serializer.py:127 msgid "project.errors.start_date_in_past" msgstr "The start date of the project lies in the past." -#: serializers/project_serializer.py:100 +#: serializers/project_serializer.py:141 msgid "project.errors.deadline_before_start_date" msgstr "The deadline of the project lies before the start date of the project." -#: serializers/project_serializer.py:142 +#: serializers/project_serializer.py:183 msgid "project.errors.zip_structure" msgstr "Error while parsing the provided zip." -#: serializers/submission_serializer.py:96 tests/test_submission.py:275 +#: serializers/submission_serializer.py:98 +msgid "project.error.submissions.project_not_started" +msgstr "The project hasn't started yet." + +#: serializers/submission_serializer.py:102 tests/test_submission.py:275 msgid "project.error.submissions.past_project" msgstr "The deadline of the project has already passed." -#: serializers/submission_serializer.py:99 tests/test_submission.py:346 +#: serializers/submission_serializer.py:105 tests/test_submission.py:346 msgid "project.error.submissions.non_visible_project" msgstr "The project is currently in a non-visible state." -#: serializers/submission_serializer.py:102 tests/test_submission.py:376 +#: serializers/submission_serializer.py:108 tests/test_submission.py:376 msgid "project.error.submissions.archived_project" msgstr "The project is archived." -#: serializers/submission_serializer.py:105 +#: serializers/submission_serializer.py:111 msgid "project.error.submissions.no_files" msgstr "The submission is empty." @@ -236,39 +240,39 @@ msgstr "The teacher was successfully added." msgid "teachers.success.destroy" msgstr "The teacher was successfully destroyed." -#: views/course_view.py:137 +#: views/course_view.py:136 msgid "courses.success.assistants.add" msgstr "The assistant was successfully added to the course." -#: views/course_view.py:164 +#: views/course_view.py:163 msgid "courses.success.assistants.remove" msgstr "The assistant was successfully removed from the course." -#: views/course_view.py:226 +#: views/course_view.py:225 msgid "courses.success.students.add" msgstr "The student was successfully added to the course." -#: views/course_view.py:247 +#: views/course_view.py:246 msgid "courses.success.students.remove" msgstr "The student was successfully removed from the course." -#: views/course_view.py:292 +#: views/course_view.py:291 msgid "courses.success.teachers.add" msgstr "The teacher was successfully added to the course." -#: views/course_view.py:316 +#: views/course_view.py:315 msgid "courses.success.teachers.remove" msgstr "The teacher was successfully removed from the course." -#: views/group_view.py:74 +#: views/group_view.py:73 msgid "group.success.students.add" msgstr "The student was successfully added to the group." -#: views/group_view.py:94 +#: views/group_view.py:93 msgid "group.success.students.remove" msgstr "The student was successfully removed from the group." -#: views/group_view.py:113 +#: views/group_view.py:112 msgid "group.success.submissions.add" msgstr "The submission was successfully added to the group." @@ -296,6 +300,6 @@ msgstr "No zip file available." msgid "extra_check_result.download.log" msgstr "No log file available." -#: views/submission_view.py:60 +#: views/submission_view.py:59 msgid "extra_check_result.download.artifact" msgstr "No artifact available." diff --git a/backend/api/models/project.py b/backend/api/models/project.py index ceb786c1..d1d250c6 100644 --- a/backend/api/models/project.py +++ b/backend/api/models/project.py @@ -76,6 +76,11 @@ def deadline_passed(self): now = timezone.now() return now > self.deadline + def has_started(self): + """Returns True if the project has started.""" + now = timezone.now() + return now >= self.start_date + def is_archived(self): """Returns True if a project is archived.""" return self.archived diff --git a/backend/api/serializers/group_serializer.py b/backend/api/serializers/group_serializer.py index b62102c7..726a0a80 100644 --- a/backend/api/serializers/group_serializer.py +++ b/backend/api/serializers/group_serializer.py @@ -81,10 +81,6 @@ def validate(self, attrs): group: Group = self.context["group"] student: Student = attrs["student"] - # Make sure a student can't join if groups are locked - if group.project.is_groups_locked(): - raise ValidationError(gettext("group.errors.locked")) - # Make sure the group is not already full if group.is_full(): raise ValidationError(gettext("group.errors.full")) diff --git a/backend/api/serializers/submission_serializer.py b/backend/api/serializers/submission_serializer.py index adf5f42e..9683ac24 100644 --- a/backend/api/serializers/submission_serializer.py +++ b/backend/api/serializers/submission_serializer.py @@ -98,6 +98,9 @@ def validate(self, attrs): group: Group = self.context["group"] project: Project = group.project + if not project.has_started(): + raise ValidationError(_("project.error.submissions.project_not_started")) + # Check if the project's deadline is not passed. if project.deadline_passed(): raise ValidationError(_("project.error.submissions.past_project")) diff --git a/backend/data/fixtures/realistic/projects/0/0/checks/generate_gibberish.sh b/backend/data/fixtures/realistic/projects/0/0/checks/generate_gibberish.sh index 9690ec1e..2deb94d8 100755 --- a/backend/data/fixtures/realistic/projects/0/0/checks/generate_gibberish.sh +++ b/backend/data/fixtures/realistic/projects/0/0/checks/generate_gibberish.sh @@ -19,4 +19,4 @@ done # Generate an artifact -wget https://golang.org/doc/gopher/modelsheet.jpg -P artifacts +wget https://upload.wikimedia.org/wikipedia/commons/5/5e/Logo_UGent_NL_RGB_2400_kleur-op-wit.png -P artifacts diff --git a/development.sh b/development.sh index 5a83cf9d..df298669 100755 --- a/development.sh +++ b/development.sh @@ -134,7 +134,6 @@ if [ "$data" != "" ]; then docker-compose -f development.yml up -d backend redis celery echo "Clearing, Migrating & Populating the database" - # We have nog fixtures for notification yet. docker-compose -f development.yml run backend sh -c "python manage.py flush --no-input; python manage.py migrate; python manage.py loaddata notifications/fixtures/$data/*; python manage.py loaddata authentication/fixtures/$data/*; python manage.py loaddata api/fixtures/$data/*;" echo "Stopping the services"