Skip to content
Snippets Groups Projects
Commit 2e589ca5 authored by permcu's avatar permcu
Browse files

Enable emptying of documentation fields

Previously empty strings where not properly handled and the previous
value persisted.
parent 00b2ced4
No related branches found
No related tags found
2 merge requests!352Draft: Resolve "Add dialog with each lesson's students",!350Resolve "Add simple course book list"
Pipeline #175641 failed
...@@ -92,9 +92,9 @@ export default { ...@@ -92,9 +92,9 @@ export default {
emits: ["open"], emits: ["open"],
data() { data() {
return { return {
topic: "", topic: null,
homework: "", homework: null,
groupNote: "", groupNote: null,
}; };
}, },
methods: { methods: {
...@@ -113,10 +113,10 @@ export default { ...@@ -113,10 +113,10 @@ export default {
}; };
}, },
save() { save() {
if (this.topic || this.homework || this.groupNote) { if (this.topic !== null || this.homework !== null || this.groupNote !== null) {
const topic = this.topic ? { topic: this.topic } : {}; const topic = this.topic !== null ? { topic: this.topic } : {};
const homework = this.homework ? { homework: this.homework } : {}; const homework = this.homework !== null ? { homework: this.homework } : {};
const groupNote = this.groupNote ? { groupNote: this.groupNote } : {}; const groupNote = this.groupNote !== null ? { groupNote: this.groupNote } : {};
this.createOrPatch([ this.createOrPatch([
{ {
...@@ -127,9 +127,9 @@ export default { ...@@ -127,9 +127,9 @@ export default {
}, },
]); ]);
this.topic = ""; this.topic = null;
this.homework = ""; this.homework = null;
this.groupNote = ""; this.groupNote = null;
} }
}, },
saveAndBlur(event) { saveAndBlur(event) {
......
...@@ -175,11 +175,11 @@ class DocumentationBatchCreateOrUpdateMutation(graphene.Mutation): ...@@ -175,11 +175,11 @@ class DocumentationBatchCreateOrUpdateMutation(graphene.Mutation):
if not info.context.user.has_perm("alsijil.edit_documentation_rule", obj): if not info.context.user.has_perm("alsijil.edit_documentation_rule", obj):
raise PermissionDenied() raise PermissionDenied()
if doc.topic: if doc.topic is not None:
obj.topic = doc.topic obj.topic = doc.topic
if doc.homework: if doc.homework is not None:
obj.homework = doc.homework obj.homework = doc.homework
if doc.group_note: if doc.group_note is not None:
obj.group_note = doc.group_note obj.group_note = doc.group_note
obj.save() obj.save()
......
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