aboutsummaryrefslogtreecommitdiff
path: root/resources/vue/components/tree/TreeNodeCourseInfo.vue
diff options
context:
space:
mode:
authorThomas Hackl <hackl@data-quest.de>2025-07-25 13:51:05 +0200
committerThomas Hackl <hackl@data-quest.de>2025-07-25 13:51:44 +0200
commit282bd39bfa8d6799761e50fca59f9a1eeb021d85 (patch)
tree886d068865bcff61ab1d1d7ed9e5f3fa69cb655c /resources/vue/components/tree/TreeNodeCourseInfo.vue
parent8b7abfdf388fdd0495dd23a3d413e9eebb77f7f2 (diff)
always cache course counts datatreecache
Diffstat (limited to 'resources/vue/components/tree/TreeNodeCourseInfo.vue')
-rw-r--r--resources/vue/components/tree/TreeNodeCourseInfo.vue26
1 files changed, 17 insertions, 9 deletions
diff --git a/resources/vue/components/tree/TreeNodeCourseInfo.vue b/resources/vue/components/tree/TreeNodeCourseInfo.vue
index 7d9f26a..2e92a09 100644
--- a/resources/vue/components/tree/TreeNodeCourseInfo.vue
+++ b/resources/vue/components/tree/TreeNodeCourseInfo.vue
@@ -1,5 +1,5 @@
<template>
- <div class="studip-tree-child-description">
+ <div v-if="node.attributes.ancestors.length > 1" class="studip-tree-child-description">
<studip-loading-skeleton v-if="isLoading" />
<div v-else>
<div v-html="$ngettext(
@@ -8,6 +8,13 @@
courseCount,
{ count: courseCount }
)"></div>
+ <div v-if="node.attributes['has-children']"
+ v-html="$ngettext(
+ '<strong>%{count}</strong> Veranstaltung auf Unterebenen',
+ '<strong>%{count}</strong> Veranstaltungen auf Unterebenen',
+ allCourseCount,
+ { count: allCourseCount }
+ )"></div>
</div>
</div>
</template>
@@ -37,11 +44,9 @@ export default {
}
},
data() {
- const cachedCourseInfo = this.getCachedNodeCourseInfo(this.node.id, this.semester, this.semClass);
-
return {
- allCourseCount: cachedCourseInfo.allCourses,
- courseCount: cachedCourseInfo.courses,
+ allCourseCount: null,
+ courseCount: null,
showingAllCourses: false
}
},
@@ -57,10 +62,13 @@ export default {
this.$emit('showAllCourses', state);
},
loadNodeInfo(node) {
- this.getNodeCourseInfo(node, this.semester, this.semClass)
- .then(info => {
- this.courseCount = info?.data.courses ?? 0;
- });
+ if (node.id) {
+ this.getNodeCourseInfo(node, this.semester, this.semClass)
+ .then(info => {
+ this.courseCount = info?.data.courses;
+ this.allCourseCount = info?.data.allcourses;
+ });
+ }
}
},
watch: {