Skip to content

Commit

Permalink
Better academic year selector, filtering and sorting (#292)
Browse files Browse the repository at this point in the history
* feat: academic year selector, better pagination and filtering composables

* chore: added course pagination
  • Loading branch information
EwoutV authored and DeLany123 committed Apr 14, 2024
1 parent a71c610 commit 4386c67
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 21 deletions.
34 changes: 17 additions & 17 deletions backend/api/management/commands/seed_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -491,26 +491,26 @@ def seed_data(self, amount, provider_function, update_function):
def handle(self, *args, **options):
start_time = time.time()
# TODO maybey take as option
# amount_of_students = 50_000
# amount_of_assistants = 300
# amount_of_teachers = 500
# amount_of_courses = 1_000
# amount_of_projects = 3_000
# amount_of_groups = 9_000
# amount_of_submissions = 50_000
# amount_of_file_extensions = 20
# amount_of_structure_checks = 12_000

amount_of_students = 10
amount_of_assistants = 0
amount_of_teachers = 0
amount_of_courses = 0
amount_of_projects = 0
amount_of_groups = 0
amount_of_submissions = 0
amount_of_students = 50_000
amount_of_assistants = 5_000
amount_of_teachers = 1_500
amount_of_courses = 1_500
amount_of_projects = 3_000
amount_of_groups = 3_000
amount_of_submissions = 3_000
amount_of_file_extensions = 0
amount_of_structure_checks = 0

# amount_of_students = 10
# amount_of_assistants = 0
# amount_of_teachers = 0
# amount_of_courses = 0
# amount_of_projects = 0
# amount_of_groups = 0
# amount_of_submissions = 0
# amount_of_file_extensions = 0
# amount_of_structure_checks = 0

self.seed_data(amount_of_students, fake.provide_student, update_Student_providers)
self.stdout.write(self.style.SUCCESS('Successfully seeded students!'))
self.seed_data(amount_of_assistants, fake.provide_assistant, update_Assistant_providers)
Expand Down
16 changes: 12 additions & 4 deletions frontend/src/components/projects/ProjectList.vue
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
<script setup lang="ts">
import { type Course } from '@/types/Course.ts';
import { computed, watch } from 'vue';
import { computed, ref, watch } from 'vue';
import { useProject } from '@/composables/services/project.service.ts';
import ProjectCard from '@/components/projects/ProjectCard.vue';
import { useI18n } from 'vue-i18n';
import moment from 'moment';
import Skeleton from 'primevue/skeleton';
import InputSwitch from 'primevue/inputswitch';
/* Props */
const props = withDefaults(
defineProps<{
courses: Course[] | null;
showPast?: boolean;
cols?: number;
}>(),
{
courses: () => [],
showPast: false,
cols: 4,
},
);
Expand All @@ -26,6 +25,7 @@ const { t } = useI18n();
const { projects, getProjectsByCourse } = useProject();
/* State */
const showPast = ref(false);
// The merged projects from all courses
const allProjects = computed(() => props.courses?.flatMap((course) => course.projects) ?? null);
Expand All @@ -35,7 +35,7 @@ const allProjects = computed(() => props.courses?.flatMap((course) => course.pro
*/
const sortedProjects = computed(() => {
const projects =
allProjects.value?.filter((project) => (!props.showPast ? moment(project.deadline).isAfter() : true)) ?? null;
allProjects.value?.filter((project) => (!showPast.value ? moment(project.deadline).isAfter() : true)) ?? null;
if (projects === null) {
return projects;
Expand Down Expand Up @@ -70,6 +70,14 @@ watch(
</script>

<template>
<!-- Show past projects switch -->
<div class="flex gap-3 align-items-center mb-5">
<InputSwitch input-id="show-past" v-model="showPast" />
<label for="show-past">
{{ t('views.dashboard.showPastProjects') }}
</label>
</div>
<!-- Project list -->
<div class="grid align-items-stretch">
<template v-if="sortedProjects !== null">
<template v-if="sortedProjects.length > 0">
Expand Down

0 comments on commit 4386c67

Please sign in to comment.