Skip to content
Snippets Groups Projects
Verified Commit 18ec1a4f authored by Jonathan Weth's avatar Jonathan Weth :keyboard:
Browse files

Merge branch '256-add-simple-course-book-list' of...

Merge branch '256-add-simple-course-book-list' of edugit.org:aleksis/official/aleksis-app-alsijil into 256-add-simple-course-book-list
parents 32467ea7 546bcab7
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 #178522 failed
......@@ -102,16 +102,33 @@ export default {
}
},
},
watch: {
documentation: {
handler() {
this.updateStatus();
},
deep: true,
}
},
mounted() {
this.updateStatus();
this.statusTimeout = setTimeout(
this.updateStatus,
this.documentationDateTimeStart.diff(DateTime.now(), "seconds").toObject()
.seconds,
);
if (DateTime.now() < this.documentationDateTimeStart) {
this.statusTimeout = setTimeout(
this.updateStatus,
this.documentationDateTimeStart.diff(DateTime.now(), "seconds").toObject(),
);
} else if (DateTime.now() < this.documentationDateTimeEnd) {
this.statusTimeout = setTimeout(
this.updateStatus,
this.documentationDateTimeEnd.diff(DateTime.now(), "seconds").toObject(),
);
}
},
beforeDestroy() {
clearTimeout(this.statusTimeout);
if (this.statusTimeout) {
clearTimeout(this.statusTimeout);
}
},
};
</script>
......@@ -160,11 +160,11 @@ export default {
(o) => o[itemId] === this.documentation.id,
);
// merged with the incoming partial documentation
// set ID of documentation currently being edited as oldID so that key in coursebook doesn't change
// if creation of proper documentation from dummy one, set ID of documentation currently being edited as oldID so that key in coursebook doesn't change
cached[index] = {
...this.documentation,
...object,
oldId: this.documentation.id,
oldId: this.documentation.id !== object.id ? this.documentation.id : this.documentation.oldId,
};
}
return cached;
......
......@@ -574,8 +574,8 @@ class Documentation(CalendarEvent):
existing_documentations := (
event_reference_obj := event["REFERENCE_OBJECT"]
).documentation.filter(
datetime_start=event["DTSTART"].dt.replace(tzinfo=timezone.utc),
datetime_end=event["DTEND"].dt.replace(tzinfo=timezone.utc),
datetime_start=event["DTSTART"].dt,
datetime_end=event["DTEND"].dt,
)
).exists()
else cls(
......
......@@ -181,9 +181,8 @@ class DocumentationBatchCreateOrUpdateMutation(graphene.Mutation):
# Timezone removal is necessary due to ISO style offsets are no valid timezones.
# Instead, we take the timezone from the lesson_event and save it in a dedicated field.
obj = Documentation.objects.create(
datetime_start=datetime.fromisoformat(datetime_start).replace(tzinfo=timezone.utc),
datetime_end=datetime.fromisoformat(datetime_end).replace(tzinfo=timezone.utc),
timezone=lesson_event.timezone,
datetime_start=datetime.fromisoformat(datetime_start).astimezone(lesson_event.timezone),
datetime_end=datetime.fromisoformat(datetime_end).astimezone(lesson_event.timezone),
lesson_event=lesson_event,
course=lesson_event.course,
subject=lesson_event.subject,
......
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