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

Extra checks frontend #417

Merged
merged 13 commits into from
May 13, 2024
Merged
7 changes: 0 additions & 7 deletions backend/api/models/checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,6 @@ class ExtraCheck(models.Model):
null=False
)

# Name of the extra check
name = models.CharField(
max_length=255,
blank=False,
null=False
)

# Link to the project
project = models.ForeignKey(
Project,
Expand Down
7 changes: 0 additions & 7 deletions backend/api/serializers/course_serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,6 @@ class CourseCloneSerializer(serializers.Serializer):
class SaveInvitationLinkSerializer(serializers.Serializer):
link_duration = serializers.IntegerField(required=True)

def validate(self, attrs):
# Check if there is no course with the same invitation link.
if Course.objects.filter(invitation_link=attrs["invitation_link"]).exists():
raise ValidationError(gettext("courses.error.invitation_link"))

return attrs

def create(self, validated_data):
# Save the invitation link and the expiration date.
if "course" not in self.context:
Expand Down
19 changes: 14 additions & 5 deletions backend/api/serializers/project_serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,18 +111,27 @@ def create(self, validated_data):
project = super().create(validated_data)

# Create groups for the project, if specified
if number_groups:
for _ in range(number_groups):
Group.objects.create(project=project)

elif project.group_size == 1:
if project.group_size == 1:
# If the group_size is set to one, create a group for each student
students = project.course.students.all()

for student in students:
group = Group.objects.create(project=project)
group.students.add(student)

elif number_groups:

for _ in range(number_groups):
Group.objects.create(project=project)

else:
# If no number of groups is passed, create #students / group_size groups
number_students = project.course.students.count()
group_size = project.group_size

for _ in range(0, number_students, group_size):
group = Group.objects.create(project=project)

# If a zip_structure is provided, parse it to create the structure checks
zip_structure: InMemoryUploadedFile | None = self.context['request'].FILES.get('zip_structure')
if zip_structure:
Expand Down
2 changes: 1 addition & 1 deletion backend/api/views/docker_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class DockerImageViewSet(RetrieveModelMixin, CreateModelMixin, UpdateModelMixin,

queryset = DockerImage.objects.all()
serializer_class = DockerImageSerializer
permission_classes = [DockerPermission, IsAdminUser]
permission_classes = [DockerPermission | IsAdminUser]

@action(detail=False)
def search(self, request: Request) -> Response:
Expand Down
15 changes: 13 additions & 2 deletions frontend/src/assets/lang/app/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,22 @@
"max_score": "Maximum score that can be achieved",
"visibility": "Make project visible to students",
"scoreVisibility": "Make score, when uploaded, automatically visible to students",
"dockerUpload": "Upload a Dockerfile",
"bashUpload": "Upload a bash script for automatic testing",
"submissionStructure": "Structure of how a submission should be made",
"noStudents": "No students in this group",
"locked": "Closed",
"unlocked": "Open"
"unlocked": "Open",
"extraChecks": {
"title": "Automatic checks on a submission",
"add": "New check",
"name": "Name",
"public": "Public",
"bashScript": "Bash script",
"dockerImage": "Docker image",
"timeLimit": "Time limit for execution (in seconds)",
"memoryLimit": "Memory limit for execution (in MB)",
"showLog": "Show logfile to students"
}
},
"submissions": {
"title": "Submissions",
Expand Down
14 changes: 12 additions & 2 deletions frontend/src/assets/lang/app/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,19 @@
"max_score": "Maximale te behalen score",
"visibility": "Project zichtbaar maken voor studenten",
"scoreVisibility": "Maak score, wanneer ingevuld, automatisch zichtbaar voor studenten",
"dockerUpload": "Upload een Dockerfile",
"submissionStructure": "Structuur van hoe de indiening moet gebeuren",
"noStudents": "Geen studenten in deze groep"
"noStudents": "Geen studenten in deze groep",
"extraChecks": {
"title": "Automatische checks op een indiening",
"add": "Nieuwe check",
"name": "Naam",
"public": "Publiek",
"bashScript": "Bash script",
"dockerImage": "Docker image",
"timeLimit": "Tijdslimiet voor de uitvoering (in seconden)",
"memoryLimit": "Geheugenlimiet voor de uitvoering (in MB)",
"showLog": "Toon logbestand aan studenten"
}
},
"submissions": {
"title": "Inzendingen",
Expand Down
Loading