Skip to content
Snippets Groups Projects
Commit 667648fc authored by Julian's avatar Julian
Browse files

Reformat

parent e77cfa11
No related branches found
No related tags found
1 merge request!361Resolve "Add statistics page for absences"
Pipeline #192708 failed
This commit is part of merge request !422. Comments created here will be created in the context of that merge request.
......@@ -4,6 +4,7 @@
<v-card-text class="d-flex flex-column" style="gap: 0.5em">
<absence-reason-chip
v-for="absenceReason in absenceReasons"
:key="absenceReason.id"
:absenceReason="absenceReason.absenceReason"
:count="absenceReason.count"
/>
......
......@@ -4,6 +4,7 @@
<v-card-text class="d-flex flex-column" style="gap: 0.5em">
<counter-chip
v-for="extraMark in extraMarks"
:key="extraMark.id"
:value="extraMark.extraMark.id"
:color="extraMark.extraMark.colourBg"
:text-color="extraMark.extraMark.colourFg"
......
......@@ -10,17 +10,40 @@
:show-select="false"
@items="items = $event"
>
<template #header.person="header">
Hello world
{{ header }}
</template>
<template v-for="(extraMark, index) in extraMarks" #[`extraMarks.${index}.count`]="{ item }">
<extra-mark-chip :extra-mark="extraMark" only-show-count dense :count="item.extraMarks.find(m => extraMark.id === m.extraMark.id).count" />
<!-- <template #header.person="header">-->
<!-- Hello world-->
<!-- {{ header }}-->
<!-- </template>-->
<template
v-for="(extraMark, index) in extraMarks"
#[`extraMarks.${index}.count`]="{ item }"
>
<extra-mark-chip
:extra-mark="extraMark"
only-show-count
dense
:count="
item.extraMarks.find((m) => extraMark.id === m.extraMark.id).count
"
/>
</template>
<template v-for="(absenceReason, index) in absenceReasons" #[`absenceReasons.${index}.count`]="{ item }">
<absence-reason-chip :absence-reason="absenceReason" onlyShowCount dense :count="item.absenceReasons.find(m => absenceReason.id === m.absenceReason.id).count" />
<template
v-for="(absenceReason, index) in absenceReasons"
#[`absenceReasons.${index}.count`]="{ item }"
>
<absence-reason-chip
:absence-reason="absenceReason"
only-show-count
dense
:count="
item.absenceReasons.find(
(m) => absenceReason.id === m.absenceReason.id,
).count
"
/>
</template>
<template #person="{ item }">
......@@ -42,7 +65,10 @@
</template>
<template #actions="{ item }">
<secondary-action-button i18n-key="alsijil.personal_notes.statistics.person_view_details" icon-text="mdi-open-in-new" />
<secondary-action-button
i18n-key="alsijil.personal_notes.statistics.person_view_details"
icon-text="mdi-open-in-new"
/>
</template>
</c-r-u-d-list>
</template>
......@@ -86,7 +112,7 @@ export default {
text: this.$t("person.name"),
value: "person",
},
...this.absenceReasons.map((reason, index) => {
...this.absenceReasons.map((reason, index) => {
return {
text: reason.name,
value: `absenceReasons.${index}.count`,
......@@ -107,19 +133,21 @@ export default {
},
{
value: "actions",
}
},
];
},
absenceReasonsFirstHeader() {
return this.absenceReasons.length > 0 ? this.absenceReasons[0].shortName + ".header" : null;
return this.absenceReasons.length > 0
? this.absenceReasons[0].shortName + ".header"
: null;
},
extraMarksFirstHeader() {
return this.extraMarks.length > 0 ? this.extraMarks[0].shortName + ".header" : null;
return this.extraMarks.length > 0
? this.extraMarks[0].shortName + ".header"
: null;
},
gqlQueryArgs() {
const term = this.schoolTerm
? { term: this.schoolTerm.id }
: {};
const term = this.schoolTerm ? { term: this.schoolTerm.id } : {};
return {
group: this.group.id,
...term,
......
......@@ -41,10 +41,12 @@
<!-- chips: absences & extraMarks -->
<absence-reason-chip
v-for="absence in items.absences"
:key="absence.id"
:absenceReason="absence"
/>
<v-chip
v-for="extraMark in item.extraMarks"
:key="extraMark.id"
:value="extraMark.id"
:color="extraMark.colourBg"
:text-color="extraMark.colourFg"
......
......@@ -76,10 +76,10 @@ query documentationsByPerson($person: ID!, $term: ID) {
query statisticsByGroup($group: ID!, $term: ID) {
items: statisticsByGroup(group: $group, term: $term) {
# persons {
# id
# fullName
# persons {
# id
# fullName
...statistics
# }
# }
}
}
......@@ -42,7 +42,6 @@ from .personal_note import (
PersonalNoteBatchDeleteMutation,
PersonalNoteBatchPatchMutation,
)
from .participation_status import ParticipationStatusBatchPatchMutation
from .statistics import (
DocumentationByPersonType,
StatisticsByPersonType,
......@@ -268,7 +267,9 @@ class Query(graphene.ObjectType):
@staticmethod
def resolve_statistics_by_group(root, info, group, term=None):
school_term = SchoolTerm.objects.get(id=term) if term is not None else SchoolTerm.get_current()
school_term = (
SchoolTerm.objects.get(id=term) if term is not None else SchoolTerm.get_current()
)
members = Group.objects.get(id=group).members.all()
return annotate_person_statistics_for_school_term(members, school_term)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment