3
3
<div class =" flex flex-wrap justify-between items-center mb-6 gap-4" >
4
4
<div >
5
5
<strong >{{ $t("Total number of courses") }}:</strong >
6
- {{ filteredVisibleCourses.length }}<br />
6
+ {{ totalVisibleCourses }}<br />
7
7
<strong >{{ $t("Matching courses") }}:</strong >
8
- {{ filteredVisibleCourses.length }}
8
+ {{ totalVisibleCourses }}
9
9
</div >
10
10
<div class =" flex gap-3" >
11
11
<Button
@@ -101,7 +101,7 @@ const onUserSubscribed = ({ courseId, newUser }) => {
101
101
const load = async () => {
102
102
status .value = true
103
103
try {
104
- const { items } = await courseService .listAll ()
104
+ const { items } = await courseService .listAll ({}, true )
105
105
courses .value = items .map ((course ) => ({
106
106
... course,
107
107
courseLanguage: findByIsoCode (course .courseLanguage )? .originalName || course .courseLanguage ,
@@ -159,28 +159,25 @@ const filteredCourses = computed(() => {
159
159
)
160
160
})
161
161
162
- const filteredVisibleCourses = computed (() => {
162
+ const visibleCoursesBase = computed (() => {
163
163
const hidePrivate = platformConfigStore .getSetting (" platform.course_catalog_hide_private" ) === " true"
164
164
165
- return filteredCourses .value .filter ((course ) => {
166
- const visibility = Number (course .visibility )
167
-
168
- if (visibility === 0 || visibility === 4 ) {
169
- return false
170
- }
171
-
172
- if (visibility === 1 && hidePrivate) {
173
- return false
174
- }
175
-
176
- return true
177
- })
165
+ return filteredCourses .value
166
+ .filter ((course ) => {
167
+ const visibility = Number (course .visibility )
168
+ if (visibility === 0 || visibility === 4 ) return false
169
+ if (visibility === 1 && hidePrivate) return false
170
+ return true
171
+ })
172
+ .sort ((a , b ) => a .title .localeCompare (b .title , undefined , { numeric: true , sensitivity: " base" }))
178
173
})
179
174
180
175
const visibleCourses = computed (() => {
181
- return filteredVisibleCourses .value .slice (0 , visibleCount .value )
176
+ return visibleCoursesBase .value .slice (0 , visibleCount .value )
182
177
})
183
178
179
+ const totalVisibleCourses = computed (() => visibleCoursesBase .value .length )
180
+
184
181
const handleScroll = () => {
185
182
if (loadingMore .value ) return
186
183
@@ -190,7 +187,7 @@ const handleScroll = () => {
190
187
const fullHeight = document .documentElement .scrollHeight
191
188
192
189
if (scrollTop + viewportHeight + threshold >= fullHeight) {
193
- if (visibleCount .value < filteredCourses .value .length ) {
190
+ if (visibleCount .value < visibleCoursesBase .value .length ) {
194
191
loadingMore .value = true
195
192
setTimeout (() => {
196
193
visibleCount .value += rowsPerScroll
0 commit comments