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 {
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) {
......
......@@ -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()
......
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