Skip to content

Commit

Permalink
fix route to submission page + fix teacher submissions page if capaci…
Browse files Browse the repository at this point in the history
…ty == 1 (#248)

* finishing touches

* requested change

* fix reroutes submissionspage
  • Loading branch information
masinnae authored May 23, 2024
1 parent 9c92dba commit ebc542a
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 50 deletions.
8 changes: 6 additions & 2 deletions frontend/src/components/submission/SubmissionTeacherCard.vue
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
<template>
<v-card v-if="!isLoading" class="parent-card">
<v-card-title>
<v-card-title v-if="capacity > 1">
{{ $t("project.group", { number: group!.num }) }}
</v-card-title>
<v-card-title v-else>
{{ group.members[0].given_name + " " + group.members[0].surname }}
</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}`" class="button">
<v-btn :to="`/submissions/${submission.group_id}`" class="button">
{{ $t("project.submissions_list") }}
</v-btn>
</v-card-actions>
Expand All @@ -22,6 +25,7 @@ import { useGroupQuery } from "@/queries/Group";
const props = defineProps<{
submission: Submission;
deadline: Date;
capacity: Number;
}>();
const { submission } = toRefs(props);
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/submission/SubmitForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ async function formOnSubmit(event: SubmitEvent) {
try {
await mutateAsync(formData);
await router.push(`/groups/${group.value?.id}`);
await router.push(`/submissions/${group.value?.id}`);
} catch (error) {
if (error instanceof UnmetRequirementsError) {
unmetRequirements.value = error.unmetRequirements;
Expand Down
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 from this group",
submissions_list: "All submissions from this person/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 van deze groep",
submissions_list: "Alle indieningen van deze persoon/groep",
submissions_list_teacher: "Alle indieningen voor dit project",
submissions_zip: "Download alle indieningen",
not_found: "Geen projecten teruggevonden.",
Expand Down
90 changes: 46 additions & 44 deletions frontend/src/views/GroupView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,50 +6,52 @@
</h1>
<v-row v-else>
<v-col class="col-sm-12 col-md-6 col-lg-8">
<h1>{{ $t("project.group", { number: group!.num }) }}</h1>
<h2>{{ "Project: " + project!.name }}</h2>
<v-card variant="flat">
<v-card-item :title="$t('group.members')">
<div v-if="group!.members.length" class="members">
<v-row
v-for="(member, index) in group!.members"
:key="index"
align="center"
>
<v-col>{{ member.given_name + " " + member.surname }}</v-col>
<v-col>
<v-btn
v-if="isTeacher"
prepend-icon="mdi-close"
color="red"
variant="flat"
@click="
() =>
removeStudent({
groupId: group!.id,
uid: member.uid,
})
"
>
{{ $t("group.remove") }}</v-btn
>
</v-col>
</v-row>
</div>
<div v-else class="members">
{{ $t("group.no_members_found") }}
</div>
</v-card-item>
<v-card-actions>
<GroupButtons
:amountOfMembers="amountOfMembers"
:group="group!"
:project="project!"
:user="user!"
:isTeacher="isTeacher!"
/>
</v-card-actions>
</v-card>
<div v-if="project!.capacity > 1">
<h1>{{ $t("project.group", { number: group!.num }) }}</h1>
<h2>{{ "Project: " + project!.name }}</h2>
<v-card variant="flat">
<v-card-item :title="$t('group.members')">
<div v-if="group!.members.length" class="members">
<v-row
v-for="(member, index) in group!.members"
:key="index"
align="center"
>
<v-col>{{ member.given_name + " " + member.surname }}</v-col>
<v-col>
<v-btn
v-if="isTeacher"
prepend-icon="mdi-close"
color="red"
variant="flat"
@click="
() =>
removeStudent({
groupId: group!.id,
uid: member.uid,
})
"
>
{{ $t("group.remove") }}</v-btn
>
</v-col>
</v-row>
</div>
<div v-else class="members">
{{ $t("group.no_members_found") }}
</div>
</v-card-item>
<v-card-actions>
<GroupButtons
:amountOfMembers="amountOfMembers"
:group="group!"
:project="project!"
:user="user!"
:isTeacher="isTeacher!"
/>
</v-card-actions>
</v-card>
</div>
<v-card variant="outlined" class="submissions">
<SubmissionList :groupId="groupId" />
</v-card>
Expand Down
1 change: 1 addition & 0 deletions frontend/src/views/SubmissionsTeacherView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
:key="submission.id"
:submission="submission"
:deadline="project.deadline"
:capacity="project.capacity"
/>
</v-skeleton-loader>
</v-col>
Expand Down
2 changes: 1 addition & 1 deletion frontend/tests/views/GroupView.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ vi.mock("@/queries/Group", () => ({
}))

const testProjectQuery = {
data: ref({subject_id: 1, name: "testproject"}),
data: ref({subject_id: 1, name: "testproject", capacity: 2}),
isLoading: ref(false),
isError: ref(false)
}
Expand Down

0 comments on commit ebc542a

Please sign in to comment.