Skip to content

Commit

Permalink
fix group id showing instead of num
Browse files Browse the repository at this point in the history
  • Loading branch information
reyniersbram committed May 22, 2024
1 parent 493bddf commit b831ad0
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 72 deletions.
140 changes: 72 additions & 68 deletions frontend/src/components/submission/SubmissionCard.vue
Original file line number Diff line number Diff line change
@@ -1,76 +1,80 @@
<template>
<v-divider />
<v-card variant="flat">
<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>
<div>
<v-divider />
<v-card variant="flat">
<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") }}
{{ $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.download_info") }}
{{ $t("submission.datetime") }} {{ $d(submission.date, "long") }}
</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>
<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>
</div>
</template>

<script setup lang="ts">
Expand Down
9 changes: 6 additions & 3 deletions frontend/src/components/submission/SubmissionTeacherCard.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<v-card class="parent-card">
<v-card v-if="!isLoading" class="parent-card">
<v-card-title>
{{ $t("project.group", { number: submission.group_id }) }}
{{ $t("project.group", { number: group!.num }) }}
</v-card-title>
<SubmissionCard class="ma-3" :submission="submission" :deadline="deadline" />
<v-divider class="divider" />
Expand All @@ -16,13 +16,16 @@
<script setup lang="ts">
import SubmissionCard from "@/components/submission/SubmissionCard.vue";
import { toRefs } from "vue";
import type Submission from "@/models/Submission";
import { useGroupQuery } from "@/queries/Group";
const props = defineProps<{
submission: Submission;
deadline: Date;
}>();
const { submission } = toRefs(props);
const { data: group, isLoading } = useGroupQuery(() => submission.value.group_id);
</script>

<style>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/views/SubmissionsTeacherView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<SubmissionTeacherCard
class="ma-3"
v-for="submission in submissions"
:key="submission"
:key="submission.id"
:submission="submission"
:deadline="project.deadline"
/>
Expand Down

0 comments on commit b831ad0

Please sign in to comment.