Skip to content

Commit

Permalink
Submissions teacher testen (#238)
Browse files Browse the repository at this point in the history
* styling

* styling

* styling

* styling

* submissionslist test

* meer testen

* format

* merge conflicts

* lint + format

* button verplaatsen

* styling klaar

* testen

* fix test after dev merge

* projectview test

* more tests

* SubmissionsTeacherView.spec.ts

* button change position

* format

* change submissioncard

* format
  • Loading branch information
masinnae authored May 22, 2024
1 parent 889e485 commit 7692926
Show file tree
Hide file tree
Showing 12 changed files with 256 additions and 158 deletions.
5 changes: 0 additions & 5 deletions frontend/src/components/project/ProjectInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@
</v-card-title>
<div v-html="renderQuillContent(project.description)"></div>
</v-card-item>
<v-card-actions>
<v-btn v-if="isTeacher" :to="`/project/${project.id}/submissions`">
{{ $t("project.submissions_list_teacher") }}
</v-btn>
</v-card-actions>
</v-card>
<SubmitInfo class="submitInfo" v-if="group" :project="project" :group="group" />
</v-container>
Expand Down
149 changes: 69 additions & 80 deletions frontend/src/components/submission/SubmissionCard.vue
Original file line number Diff line number Diff line change
@@ -1,86 +1,75 @@
<template>
<v-divider />
<v-card variant="flat">
<v-row>
<v-col>
<v-card-title>
{{ $t("submission.status") }}
<p
v-if="new Date(submission.date) <= deadline"
:class="Status[submission.status]"
>
{{ Status[submission.status] }}
</p>
<p v-else class="Deadline">{{ $t("submission.after_deadline") }}</p>
</v-card-title>
<v-card-subtitle>
{{ $t("submission.datetime") }} {{ $d(submission.date, "long") }}
</v-card-subtitle>
<v-card-item>
<v-card-title>
{{ $t("submission.remarks") }}
</v-card-title>
<v-card-text v-if="submission.remarks">
{{ submission.remarks }}
</v-card-text>
<v-card-subtitle v-else>
{{ $t("submission.remarks_empty") }}
</v-card-subtitle>
</v-card-item>
<v-card-item
v-if="submission.stderr || submission.stdout || submission.testresults.length"
>
<v-card-title>{{ $t("submission.docker_test") }}</v-card-title>
<v-card-text>
<p v-if="submission.stdout">Stdout: {{ submission.stdout }}</p>
<p v-if="submission.stderr">Sterr: {{ submission.stderr }}</p>
<ul>
<li v-for="result in submission.testresults" :key="result">
<p v-if="result.succeeded" class="text-green">{{ result.value }}</p>
<p v-else class="text-red">{{ result.value }}</p>
</li>
</ul>
</v-card-text>
</v-card-item>
</v-col>
<v-col>
<v-card-item>
<v-card-title>
{{ $t("submission.files") }}
</v-card-title>
<v-card-subtitle>
{{ $t("submission.download_info") }}
</v-card-subtitle>
<v-container>
<v-alert
v-if="isError"
title="Error"
color="error"
:text="error!.message"
></v-alert>
<v-skeleton-loader v-else :loading="isLoading" type="card">
<v-col>
<v-chip
class="ma-2"
v-for="(item, index) in files"
label
color="blue"
:key="item.filesortedname"
@click="() => downloadFile(index)"
>
{{ item.filename }}
</v-chip>
</v-col>
</v-skeleton-loader>
</v-container>
<v-card-actions>
<v-btn @click="downloadAll">
{{ $t("submission.download_all_files") }}
</v-btn>
</v-card-actions>
</v-card-item>
</v-col>
</v-row>
<v-card-title>
{{ $t("submission.status") }}
<p v-if="new Date(submission.date) <= deadline" :class="Status[submission.status]">
{{ Status[submission.status] }}
</p>
<p v-else class="Deadline">{{ $t("submission.after_deadline") }}</p>
</v-card-title>
<v-card-subtitle>
{{ $t("submission.datetime") }} {{ $d(submission.date, "long") }}
</v-card-subtitle>
<v-card-item>
<v-card-title>
{{ $t("submission.remarks") }}
</v-card-title>
<v-card-text v-if="submission.remarks">
{{ submission.remarks }}
</v-card-text>
<v-card-subtitle v-else>
{{ $t("submission.remarks_empty") }}
</v-card-subtitle>
</v-card-item>
<v-card-item v-if="submission.stderr || submission.stdout || submission.testresults.length">
<v-card-title>{{ $t("submission.docker_test") }}</v-card-title>
<v-card-text>
<p v-if="submission.stdout">Stdout: {{ submission.stdout }}</p>
<p v-if="submission.stderr">Sterr: {{ submission.stderr }}</p>
<ul>
<li v-for="result in submission.testresults" :key="result">
<p v-if="result.succeeded" class="text-green">{{ result.value }}</p>
<p v-else class="text-red">{{ result.value }}</p>
</li>
</ul>
</v-card-text>
</v-card-item>
<v-card-item>
<v-card-title>
{{ $t("submission.files") }}
</v-card-title>
<v-card-subtitle>
{{ $t("submission.download_info") }}
</v-card-subtitle>
<v-container>
<v-alert
v-if="isError"
title="Error"
color="error"
:text="error!.message"
></v-alert>
<v-skeleton-loader v-else :loading="isLoading" type="card">
<v-col>
<v-chip
class="ma-2"
v-for="(item, index) in files"
label
color="blue"
:key="item.filesortedname"
@click="() => downloadFile(index)"
>
{{ item.filename }}
</v-chip>
</v-col>
</v-skeleton-loader>
</v-container>
<v-card-actions>
<v-btn @click="downloadAll">
{{ $t("submission.download_all_files") }}
</v-btn>
</v-card-actions>
</v-card-item>
</v-card>
</template>

Expand Down
15 changes: 12 additions & 3 deletions frontend/src/components/submission/SubmissionTeacherCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@
<v-card-title>
{{ $t("project.group", { number: submission.group_id }) }}
</v-card-title>

<SubmissionCard class="ma-3" :submission="submission" :deadline="deadline" />

<v-divider class="divider" />
<v-card-actions>
<v-btn :to="`/groups/${submission.group_id}`">
<v-btn :to="`/groups/${submission.group_id}`" class="button">
{{ $t("project.submissions_list") }}
</v-btn>
</v-card-actions>
Expand All @@ -32,6 +31,16 @@ const { submission } = toRefs(props);
}
.parent-card {
background-color: rgb(var(--v-theme-background));
padding: 10px;
width: 100%;
}
.button {
background-color: rgb(var(--v-theme-secondary));
}
.divider {
margin-bottom: 10px;
}
</style>
2 changes: 1 addition & 1 deletion frontend/src/i18n/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export default {
myProject: "My projects",
capacity_group: "Capacity: ",
edit: "Edit project",
submissions_list: "All submissions",
submissions_list: "All submissions from this group",
submissions_list_teacher: "All submissions for this project",
submissions_zip: "Download all submissions",
not_found: "No projects found.",
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/i18n/locales/nl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export default {
myProject: "Mijn projecten",
capacity_group: "Capaciteit: ",
edit: "Bewerk project",
submissions_list: "Alle indieningen",
submissions_list: "Alle indieningen van deze groep",
submissions_list_teacher: "Alle indieningen voor dit project",
submissions_zip: "Download alle indieningen",
not_found: "Geen projecten teruggevonden.",
Expand Down
6 changes: 0 additions & 6 deletions frontend/src/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,6 @@ const router = createRouter({
component: () => import("../views/SubjectRegisterView.vue"),
props: (route) => ({ uuid: String(route.params.uuid) }),
},
{
path: "/submissions/:submissionId(\\d+)",
name: "submission",
component: () => import("../views/SubmissionView.vue"),
props: (route) => ({ submissionId: Number(route.params.submissionId) }),
},
{
path: "/settings",
name: "settings",
Expand Down
21 changes: 21 additions & 0 deletions frontend/src/views/ProjectView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@
:subject="subject!"
:user="user!"
/>
<v-btn
v-if="isTeacher"
:to="`/project/${project.id}/submissions`"
class="allsubmissions"
variant="flat"
>
{{ $t("project.submissions_list_teacher") }}
</v-btn>
</v-col>
<v-col cols="2" class="button-container">
<ProjectSideBar
Expand Down Expand Up @@ -87,11 +95,24 @@ const isDataError = computed(
isSubjectError.value ||
isUserError.value
);
const isTeacher = computed(
() =>
user.value.is_teacher ||
user.value.is_admin ||
instructors.value?.some((element) => element.uid == user.value.uid)
);
</script>

<style scoped>
.button-container {
margin-top: 20px;
min-width: 200px;
}
.allsubmissions {
margin: 15px;
background-color: rgb(var(--v-theme-primary));
color: rgb(var(--v-theme-navtext));
}
</style>
33 changes: 0 additions & 33 deletions frontend/src/views/SubmissionView.vue

This file was deleted.

Loading

0 comments on commit 7692926

Please sign in to comment.