Skip to content

Commit

Permalink
Add HSB as comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
PassiDel committed Jun 6, 2024
1 parent 91cef0c commit 45fdfb1
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 4 deletions.
15 changes: 15 additions & 0 deletions src/components/DataSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,21 @@ const selected = defineModel('selected', { default: 0 });
:class="{ 'text-right': right }"
>
<VaAccordion stateful>
<VaCollapse>
<template #header-content>
<a href="#" @click.prevent="() => (selected = -1)">
<h3
class="text-xl font-bold hover:underline"
:class="{
underline: selected === -1,
italic: selectedFaculty === -1
}"
>
HSB
</h3></a
>
</template>
</VaCollapse>
<VaCollapse v-for="(faculty, i) in faculties" :key="`f-${i}`">
<template #header-content>
<a href="#" @click.prevent="() => (selected = faculty.number)">
Expand Down
12 changes: 10 additions & 2 deletions src/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,12 @@ const DegreeHistoryKeys = [
'total',
'femaleGerman',
'maleGerman',
'totalGerman',
'totalForeign',
'totalGerman'
'diverseGerman',
'diverseForeign',
'maleForeign',
'femaleForeign'
] as const;

export function sumDegrees(
Expand Down Expand Up @@ -203,7 +207,11 @@ export function sumDegreesAllYears(faculty: (typeof faculties)[0]): DegreeData {
femaleGerman: 0,
maleGerman: 0,
totalGerman: 0,
totalForeign: 0
totalForeign: 0,
diverseGerman: 0,
diverseForeign: 0,
maleForeign: 0,
femaleForeign: 0
}
};
fd.semester.push(year);
Expand Down
22 changes: 20 additions & 2 deletions src/views/CompareDegreesView.vue
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<script setup lang="ts">
import DataSelect from '@/components/DataSelect.vue';
import { computed, ref } from 'vue';
import { faculties, type Semester } from '@/data';
import { degrees, faculties, type Semester, sumDegreesAllYears } from '@/data';
import CompareDegree from '@/components/CompareDegree.vue';
import { useQuery } from '@/composables/useQuery';
import CompareFaculty from '@/components/CompareFaculty.vue';
import PlayBar from '@/components/PlayBar.vue';
import { getSemesterFromDegrees } from '@/utils/semester';
const { left, right } = useQuery({ left: 0, right: 0 });
const { left, right } = useQuery({ left: -1, right: -1 });
const leftDegree = computed(() =>
faculties
Expand All @@ -28,6 +28,12 @@ const rightFaculty = computed(() =>
faculties.find((f) => f.number === right.value)
);
const faculty = { name: 'HS Bremen', number: 0, degrees };
const hsb = {
f: { name: 'HS Bremen', number: 0 },
...sumDegreesAllYears(faculty)
};
const years = computed<Semester[]>(() =>
getSemesterFromDegrees(
leftDegree.value,
Expand Down Expand Up @@ -58,6 +64,12 @@ const year = ref<Semester>(years.value[years.value.length - 1]);
:year="year"
class="degree"
/>
<CompareDegree
v-else-if="left === -1"
:year="year"
:degree="hsb"
class="degree"
/>
<div v-else class="col-span-2">
<h2 class="hidden md:block">
Wähle links einen <span class="font-bold">Studiengang</span><br />
Expand All @@ -81,6 +93,12 @@ const year = ref<Semester>(years.value[years.value.length - 1]);
:year="year"
class="degree"
/>
<CompareDegree
v-else-if="right === -1"
:year="year"
:degree="hsb"
class="degree"
/>
<div v-else class="col-span-2">
<h2 class="hidden md:block">
Wähle rechts einen <span class="font-bold">Studiengang</span><br />
Expand Down

0 comments on commit 45fdfb1

Please sign in to comment.