diff --git a/aleksis/apps/alsijil/frontend/components/coursebook/documentation/LessonSummary.vue b/aleksis/apps/alsijil/frontend/components/coursebook/documentation/LessonSummary.vue index 49eb534e2b18aa4d164f8f05430beb1b942fc6a9..3e4d218774b044410c27bb331c24ada5ecaf2657 100644 --- a/aleksis/apps/alsijil/frontend/components/coursebook/documentation/LessonSummary.vue +++ b/aleksis/apps/alsijil/frontend/components/coursebook/documentation/LessonSummary.vue @@ -92,9 +92,9 @@ export default { emits: ["open"], data() { return { - topic: "", - homework: "", - groupNote: "", + topic: null, + homework: null, + groupNote: null, }; }, methods: { @@ -113,10 +113,10 @@ export default { }; }, save() { - if (this.topic || this.homework || this.groupNote) { - const topic = this.topic ? { topic: this.topic } : {}; - const homework = this.homework ? { homework: this.homework } : {}; - const groupNote = this.groupNote ? { groupNote: this.groupNote } : {}; + if (this.topic !== null || this.homework !== null || this.groupNote !== null) { + const topic = this.topic !== null ? { topic: this.topic } : {}; + const homework = this.homework !== null ? { homework: this.homework } : {}; + const groupNote = this.groupNote !== null ? { groupNote: this.groupNote } : {}; this.createOrPatch([ { @@ -127,9 +127,9 @@ export default { }, ]); - this.topic = ""; - this.homework = ""; - this.groupNote = ""; + this.topic = null; + this.homework = null; + this.groupNote = null; } }, saveAndBlur(event) { diff --git a/aleksis/apps/alsijil/schema/documentation.py b/aleksis/apps/alsijil/schema/documentation.py index c528540cad1164620139f89cd3749863d8835be7..71ad9c468770d0952fb7990c7f14c3ea5d23ee25 100644 --- a/aleksis/apps/alsijil/schema/documentation.py +++ b/aleksis/apps/alsijil/schema/documentation.py @@ -175,11 +175,11 @@ class DocumentationBatchCreateOrUpdateMutation(graphene.Mutation): if not info.context.user.has_perm("alsijil.edit_documentation_rule", obj): raise PermissionDenied() - if doc.topic: + if doc.topic is not None: obj.topic = doc.topic - if doc.homework: + if doc.homework is not None: obj.homework = doc.homework - if doc.group_note: + if doc.group_note is not None: obj.group_note = doc.group_note obj.save()