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

Query lesson documentations via graphql

parent 876d7706
No related branches found
No related tags found
No related merge requests found
Pipeline #79804 canceled
......@@ -9,7 +9,7 @@
{% endblock %}
{% block browser_title %}{% trans "Coursebook" %} {{ lesson }}{% endblock %}
{% block content %}
<course-book></course-book>
<course-book lesson-id="{{ lesson.id }}"></course-book>
{% endblock %}
{% block extra_body %}
......
......@@ -23,653 +23,115 @@ export default {
}, 500)
}
},
props: [],
props: ["lessonId"],
name: "course-book",
data: () => {
return {
ping: "ping",
status: SAVED,
"excuseTypes": [
{
"name": "🐬",
"shortName": "🐬"
},
{
"name": ":",
"shortName": ":"
},
{
"name": ":))))",
"shortName": "(😀)"
},
{
"name": "Schulisch entschuldigt",
"shortName": "s"
},
{
"name": "asdlasdhlaksdhalkshd",
"shortName": "a"
},
{
"name": "ddddd",
"shortName": "d"
},
{
"name": "smiley",
"shortName": "😀"
},
{
"name": "ääääääääääääääääääääääääääääää",
"shortName": "üüüüüüüüüüüüüüüüüüüüüüüüüüüü"
}
],
"lesson": {
"groups": [
{
"name": "Ea, Eb, Ec, Ed: La1",
"shortName": "EaEbEcEd-La1",
"members": [
{
"id": "87",
"fullName": "Mustermann, Max"
},
{
"id": "76",
"fullName": "Weth, Jonathan"
}
]
}
],
"subject": {
"name": "Latein 1"
}
},
"lessonDocumentations": [
{
"topic": "",
"homework": "",
"groupNote": "",
"period": 1,
"date": "2020-08-03",
"personalNotes": [
{
"person": {
"id": "87",
"fullName": "Mustermann, Max"
},
"late": 0,
"absent": true,
"excused": false,
"excuseType": null,
"remarks": "",
"extraMarks": []
},
{
"person": {
"id": "76",
"fullName": "Weth, Jonathan"
},
"late": 0,
"absent": false,
"excused": false,
"excuseType": null,
"remarks": "",
"extraMarks": []
}
]
},
{
"topic": "Ovid gelesen",
"homework": "übersetzen zeile 1",
"groupNote": "",
"period": 5,
"date": "2020-06-26",
"personalNotes": [
{
"person": {
"id": "87",
"fullName": "Mustermann, Max"
},
"late": 0,
"absent": false,
"excused": false,
"excuseType": null,
"remarks": "sehr laut",
"extraMarks": [
{
"name": "Homework forgotten",
"shortName": "HA"
}
]
},
{
"person": {
"id": "76",
"fullName": "Weth, Jonathan"
},
"late": 0,
"absent": true,
"excused": true,
"excuseType": null,
"remarks": "",
"extraMarks": []
}
]
},
{
"topic": "",
"homework": "",
"groupNote": "",
"period": 2,
"date": "2020-06-22",
"personalNotes": [
{
"person": {
"id": "87",
"fullName": "Mustermann, Max"
},
"late": 0,
"absent": true,
"excused": false,
"excuseType": null,
"remarks": "",
"extraMarks": []
}
]
},
{
"topic": "",
"homework": "",
"groupNote": "",
"period": 1,
"date": "2020-06-22",
"personalNotes": [
{
"person": {
"id": "87",
"fullName": "Mustermann, Max"
},
"late": 0,
"absent": true,
"excused": false,
"excuseType": null,
"remarks": "",
"extraMarks": []
},
{
"person": {
"id": "76",
"fullName": "Weth, Jonathan"
},
"late": 0,
"absent": true,
"excused": true,
"excuseType": null,
"remarks": "",
"extraMarks": []
}
]
},
{
"topic": "",
"homework": "",
"groupNote": "",
"period": 5,
"date": "2020-06-19",
"personalNotes": [
{
"person": {
"id": "87",
"fullName": "Mustermann, Max"
},
"late": 0,
"absent": false,
"excused": false,
"excuseType": null,
"remarks": "",
"extraMarks": []
},
{
"person": {
"id": "76",
"fullName": "Weth, Jonathan"
},
"late": 0,
"absent": true,
"excused": true,
"excuseType": null,
"remarks": "",
"extraMarks": []
}
]
},
{
"topic": "",
"homework": "",
"groupNote": "",
"period": 2,
"date": "2020-06-15",
"personalNotes": [
{
"person": {
"id": "87",
"fullName": "Mustermann, Max"
},
"late": 0,
"absent": false,
"excused": false,
"excuseType": null,
"remarks": "",
"extraMarks": []
},
{
"person": {
"id": "76",
"fullName": "Weth, Jonathan"
},
"late": 0,
"absent": true,
"excused": true,
"excuseType": null,
"remarks": "",
"extraMarks": []
}
]
},
{
"topic": "",
"homework": "",
"groupNote": "",
"period": 1,
"date": "2020-06-15",
"personalNotes": [
{
"person": {
"id": "87",
"fullName": "Mustermann, Max"
},
"late": 0,
"absent": false,
"excused": false,
"excuseType": null,
"remarks": "",
"extraMarks": [
{
"name": "Homework forgotten",
"shortName": "HA"
}
]
},
{
"person": {
"id": "76",
"fullName": "Weth, Jonathan"
},
"late": 0,
"absent": true,
"excused": true,
"excuseType": null,
"remarks": "",
"extraMarks": [
{
"name": "Homework forgotten",
"shortName": "HA"
}
]
}
]
},
{
"topic": "Blub",
"homework": "Das ist die HA",
"groupNote": "",
"period": 5,
"date": "2020-06-12",
"personalNotes": [
{
"person": {
"id": "87",
"fullName": "Mustermann, Max"
},
"late": 0,
"absent": true,
"excused": false,
"excuseType": null,
"remarks": "",
"extraMarks": []
},
{
"person": {
"id": "76",
"fullName": "Weth, Jonathan"
},
"late": 0,
"absent": true,
"excused": true,
"excuseType": null,
"remarks": "",
"extraMarks": []
}
]
},
{
"topic": "",
"homework": "",
"groupNote": "",
"period": 2,
"date": "2020-06-08",
"personalNotes": [
{
"person": {
"id": "87",
"fullName": "Mustermann, Max"
},
"late": 0,
"absent": false,
"excused": false,
"excuseType": null,
"remarks": "",
"extraMarks": []
},
{
"person": {
"id": "76",
"fullName": "Weth, Jonathan"
},
"late": 0,
"absent": true,
"excused": true,
"excuseType": {
"name": "Schulisch entschuldigt",
"shortName": "s"
},
"remarks": "",
"extraMarks": []
}
]
},
{
"topic": "",
"homework": "",
"groupNote": "",
"period": 5,
"date": "2020-05-08",
"personalNotes": [
{
"person": {
"id": "87",
"fullName": "Mustermann, Max"
},
"late": 5,
"absent": false,
"excused": false,
"excuseType": null,
"remarks": "",
"extraMarks": [
{
"name": "Homework forgotten",
"shortName": "HA"
}
]
},
{
"person": {
"id": "76",
"fullName": "Weth, Jonathan"
},
"late": 0,
"absent": true,
"excused": true,
"excuseType": null,
"remarks": "",
"extraMarks": [
{
"name": "Homework forgotten",
"shortName": "HA"
}
]
}
]
},
{
"topic": "Test",
"homework": "AB beenden",
"groupNote": "Stört!",
"period": 2,
"date": "2020-05-04",
"personalNotes": [
{
"person": {
"id": "87",
"fullName": "Mustermann, Max"
},
"late": 5,
"absent": true,
"excused": true,
"excuseType": null,
"remarks": "Petta",
"extraMarks": [
{
"name": "Homework forgotten",
"shortName": "HA"
}
]
},
{
"person": {
"id": "76",
"fullName": "Weth, Jonathan"
},
"late": 0,
"absent": true,
"excused": true,
"excuseType": null,
"remarks": "",
"extraMarks": []
}
]
},
{
"topic": "Metrische Analyse des Proömiums, Übersetzung bis V.11, Charakterisierung Aeneas' und Junos",
"homework": "Übersetzung bis V. 17 \"fuit\", Vokabeln Rest, Proömium üben!!",
"groupNote": "Einige Mitglieder des Kurses leiden an Vokabeleritis",
"period": 1,
"date": "2020-05-04",
"personalNotes": [
{
"person": {
"id": "87",
"fullName": "Mustermann, Max"
},
"late": 0,
"absent": true,
"excused": true,
"excuseType": null,
"remarks": "",
"extraMarks": []
},
{
"person": {
"id": "76",
"fullName": "Weth, Jonathan"
},
"late": 0,
"absent": true,
"excused": true,
"excuseType": null,
"remarks": "",
"extraMarks": []
}
]
},
{
"topic": "",
"homework": "",
"groupNote": "",
"period": 5,
"date": "2020-05-01",
"personalNotes": [
{
"person": {
"id": "87",
"fullName": "Mustermann, Max"
},
"late": 0,
"absent": false,
"excused": false,
"excuseType": null,
"remarks": "",
"extraMarks": []
},
{
"person": {
"id": "76",
"fullName": "Weth, Jonathan"
},
"late": 0,
"absent": true,
"excused": true,
"excuseType": null,
"remarks": "",
"extraMarks": []
}
]
},
{
"topic": "",
"homework": "",
"groupNote": "",
"period": 5,
"date": "2020-03-06",
"personalNotes": [
{
"person": {
"id": "87",
"fullName": "Mustermann, Max"
},
"late": 0,
"absent": false,
"excused": false,
"excuseType": null,
"remarks": "",
"extraMarks": []
},
{
"person": {
"id": "76",
"fullName": "Weth, Jonathan"
},
"late": 0,
"absent": true,
"excused": false,
"excuseType": null,
"remarks": "",
"extraMarks": []
}
]
},
{
"topic": "",
"homework": "",
"groupNote": "",
"period": 2,
"date": "2020-03-02",
"personalNotes": [
{
"person": {
"id": "87",
"fullName": "Mustermann, Max"
},
"late": 0,
"absent": false,
"excused": false,
"excuseType": null,
"remarks": "",
"extraMarks": []
},
{
"person": {
"id": "76",
"fullName": "Weth, Jonathan"
},
"late": 0,
"absent": true,
"excused": true,
"excuseType": null,
"remarks": "",
"extraMarks": []
}
]
},
{
"topic": "",
"homework": "",
"groupNote": "",
"period": 1,
"date": "2020-03-02",
"personalNotes": [
{
"person": {
"id": "87",
"fullName": "Mustermann, Max"
},
"late": 0,
"absent": false,
"excused": false,
"excuseType": null,
"remarks": "",
"extraMarks": []
},
{
"person": {
"id": "76",
"fullName": "Weth, Jonathan"
},
"late": 0,
"absent": true,
"excused": true,
"excuseType": null,
"remarks": "",
"extraMarks": []
}
]
}
],
"extraMarks": [
{
"name": "Homework forgotten",
"shortName": "HA"
}
]
// lessonId: 352
}
},
template: `
<div>
<update-indicator @manual-update="updateManually()" ref="indicator" :status="status"></update-indicator>
<v-subheader>{{ lesson.subject.name }}</v-subheader>
<v-row>
<v-col v-for="item in lessonDocumentations" cols="12" v-bind:key="item.id">
<lesson-documentation
v-bind:key="item.id" :groups="lesson.groups" :excuse-types="excuseTypes" :extra-marks="extraMarks"
:period="item.period"
:personal-notes="item.personalNotes"
@change-personal-notes="processDataChange"
:date="item.date"
@change-date="processDataChange"
:topic="item.topic"
@change-topic="processDataChange"
:homework="item.homework"
@change-homework="processDataChange"
:group-note="item.groupNote"
@change-group-note="processDataChange"
></lesson-documentation>
</v-col>
</v-row>
</div>
`
<ApolloQuery
:query="gql => gql\`
query CourseBook($lessonId: ID!) {
excuseTypes {
name
shortName
}
lesson: lessonsById(id: $lessonId) {
groups {
name
shortName
members {
id
fullName
}
}
subject {
name
}
}
lessonDocumentations: lessonDocumentationsByLessonId(id: $lessonId) {
topic
homework
groupNote
period
date
personalNotes {
person {
id
fullName
}
late
absent
excused
excuseType {
name
shortName
}
remarks
extraMarks {
name
shortName
}
}
}
extraMarks {
name
shortName
}
}
\`"
:variables="{ lessonId }"
>
<template v-slot="{ result: { loading, error, data } }">
<!-- Error -->
<div v-if="error" class="error apollo">An error occurred</div>
<!-- Result -->
<div v-else-if="data" class="result apollo">
<update-indicator @manual-update="updateManually()" ref="indicator" :status="status"></update-indicator>
<v-subheader>{{ data.lesson.subject.name }}</v-subheader>
<v-row v-if="data.lessonDocumentations.length > 0">
<v-col v-for="item in data.lessonDocumentations" cols="12" v-bind:key="item.id">
<lesson-documentation
v-bind:key="item.id"
:groups="data.lesson.groups"
:excuse-types="data.excuseTypes"
:extra-marks="data.extraMarks"
:period="item.period"
:personal-notes="item.personalNotes"
@change-personal-notes="processDataChange"
:date="item.date"
@change-date="processDataChange"
:topic="item.topic"
@change-topic="processDataChange"
:homework="item.homework"
@change-homework="processDataChange"
:group-note="item.groupNote"
@change-group-note="processDataChange"
></lesson-documentation>
</v-col>
</v-row>
<message-box v-else type="info">No coursebook for you :(</message-box>
</div>
<!-- No result or Loading -->
<div v-else>
<v-progress-circular
indeterminate
color="primary"
class="ma-auto"
></v-progress-circular>
</div>
</template>
</ApolloQuery>`
}
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