Skip to content

Commit

Permalink
Move submissions list to group page
Browse files Browse the repository at this point in the history
  • Loading branch information
xerbalind committed May 18, 2024
1 parent c948aec commit 761162d
Show file tree
Hide file tree
Showing 11 changed files with 36 additions and 24 deletions.
11 changes: 5 additions & 6 deletions backend/src/submission/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ async def create_submission(background_tasks: BackgroundTasks,
submission_in: SubmissionCreate = Depends(),
group: Group = Depends(retrieve_group),
user: User = Depends(get_authenticated_user),
db: AsyncSession = Depends(get_async_db),
client=Depends(get_docker_client)):
db: AsyncSession = Depends(get_async_db)):
project = await retrieve_project(group.project_id, user, db)
test_files_uuid = project.test_files_uuid
submission_uuid = upload_files(submission_in.files, project)
Expand All @@ -62,10 +61,10 @@ async def create_submission(background_tasks: BackgroundTasks,
db, uuid=submission_uuid, remarks=submission_in.remarks, status=status, group_id=group.id, project_id=group.project_id
)

# launch docker tests
if docker_tests_present:
background_tasks.add_task(launch_docker_tests,
submission.id, submission.files_uuid, test_files_uuid, db, client)
""" # launch docker tests """
""" if docker_tests_present: """
""" background_tasks.add_task(launch_docker_tests, """
""" submission.id, submission.files_uuid, test_files_uuid, db, client) """

return submission

Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/project/ProjectInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<div v-html="renderQuillContent(project.description)"></div>
</v-card-item>
<v-card-actions>
<v-btn color="blue" v-if="isTeacher" :to="`/project/${project.id}/submissions`">
<v-btn v-if="isTeacher" :to="`/project/${project.id}/submissions`">
{{ $t("project.submissions_list_teacher") }}
</v-btn>
</v-card-actions>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/project/submit/SubmitForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ async function formOnSubmit(event: SubmitEvent) {
}
await mutateAsync(formData);
await router.push(`/groups/${group.value?.id}/submissions`);
await router.push(`/groups/${group.value?.id}`);
}
</script>

Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/project/submit/SubmitInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<v-btn :to="`/project/${project?.id}/submit`">
{{ $t("submit.new_submission") }}
</v-btn>
<v-btn :to="`/groups/${group?.id}/submissions`">
<v-btn :to="`/groups/${group?.id}`">
{{ $t("project.submissions_list") }}
</v-btn>
</v-card-actions>
Expand Down
13 changes: 10 additions & 3 deletions frontend/src/components/submission/SubmissionCard.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<v-card>
<v-card variant="outlined">
<v-card-title>
{{ $t("submission.status") }}
<p v-if="new Date(submission.date) <= deadline" :class="Status[submission.status]">
Expand All @@ -25,9 +25,7 @@
<v-card-title>{{ $t("submission.docker_test") }}</v-card-title>
<v-card-text>
<p v-if="submission.stdout">Stdout: {{ submission.stdout }}</p>
<p v-else>{{ $t("default.no") }} stdout</p>
<p v-if="submission.stderr">Sterr: {{ submission.stderr }}</p>
<p v-else>{{ $t("default.no") }} stderr</p>
<ul>
<li v-for="result in submission.testresults" :key="result">
<p v-if="result.succeeded" class="text-green">{{ result.value }}</p>
Expand Down Expand Up @@ -128,4 +126,13 @@ const downloadAll = () => {
.Deadline {
color: red;
}
.v-btn {
background-color: rgb(var(--v-theme-secondary));
}
.v-card {
border-color: rgb(var(--v-theme-text));
background-color: rgb(var(--v-theme-background));
}
</style>
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<v-alert v-if="isError" title="Error" color="error" :text="error.message"></v-alert>
<v-skeleton-loader v-else :loading="isLoading || !projectSuccess" type="card">
<v-col class="mx-auto">
<h1>{{ $t("submission.submissions_title", { project: project.name }) }}</h1>
<h2>{{ $t("submission.submissions_title") }}</h2>
<div v-if="sorted.length == 0">
<p>{{ $t("submission.no_submissions") }}</p>
<v-btn :to="`/project/${project?.id}/submit`">
Expand Down
16 changes: 13 additions & 3 deletions frontend/src/components/submission/SubmissionTeacherCard.vue
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<template>
<v-card>
<v-card class="parent-card">
<v-card-title>
{{ $t("project.group", { number: submission.group_id }) }}
</v-card-title>

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

<v-card-actions>
<v-btn :to="`/groups/${submission.group_id}/submissions`">
<v-btn :to="`/groups/${submission.group_id}`">
{{ $t("project.submissions_list") }}
</v-btn>
</v-card-actions>
Expand All @@ -20,8 +20,18 @@ import { toRefs } from "vue";
const props = defineProps<{
submission: Submission;
deadline: string;
deadline: Date;
}>();
const { submission } = toRefs(props);
</script>

<style>
.v-card {
border-color: rgb(var(--v-theme-text));
}
.parent-card {
background-color: rgb(var(--v-theme-secondary));
}
</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 @@ -41,7 +41,7 @@ export default {
files: "Files",
download_info: "Click on filename to download",
after_deadline: "After deadline",
submissions_title: "Submissions for project {project}",
submissions_title: "Submissions:",
no_submissions: "No submissions yet",
teacher_submissions_info:
"This page contains a list of the latest submission of each group for this project.",
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 @@ -41,7 +41,7 @@ export default {
files: "Bestanden",
download_info: "Klik op bestandsnaam om te downloaden",
after_deadline: "Na deadline",
submissions_title: "Indieningen voor project {project}",
submissions_title: "Indieningen:",
no_submissions: "Nog geen indieningen",
teacher_submissions_info:
"Deze pagina bevat een lijst van de laatste indiening van elke groep voor dit project.",
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 @@ -106,12 +106,6 @@ const router = createRouter({
component: () => import("../views/SubmissionView.vue"),
props: (route) => ({ submissionId: Number(route.params.submissionId) }),
},
{
path: "/groups/:groupId(\\d+)/submissions",
name: "submissions",
component: () => import("../views/SubmissionsView.vue"),
props: (route) => ({ groupId: Number(route.params.groupId) }),
},
{
path: "/settings",
name: "settings",
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/views/GroupView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
/>
</v-card-actions>
</v-card>
<SubmissionList :groupId="groupId" />
</div>
</v-container>
</template>
Expand All @@ -55,6 +56,7 @@ import { useGroupQuery, useRemoveUserFromGroupMutation } from "@/queries/Group";
import { useProjectQuery } from "@/queries/Project";
import { useCurrentUserQuery } from "@/queries/User";
import GroupButtons from "@/components/buttons/GroupButtons.vue";
import SubmissionList from "@/components/submission/SubmissionList.vue";
import { useSubjectInstructorsQuery } from "@/queries/Subject";
const props = defineProps<{
Expand Down

0 comments on commit 761162d

Please sign in to comment.