Skip to content

Commit 59313d2

Browse files
committed
fix missing lesson data
1 parent 497a58b commit 59313d2

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

‎apps/codingcatdev/src/lib/server/content.ts‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -154,14 +154,14 @@ export const getContentBySlug = async (contentType: ContentType, slug: string) =
154154
.sort((a, b) => new Date(b.start).valueOf() - new Date(a.start).valueOf())
155155
.slice(0, 1)
156156
.map((c: Course) => {
157-
if (c?.lesson) {
158-
c.lesson
159-
.filter(
160-
(d) => new Date(d.start) <= new Date() && d.published === ContentPublished.published
157+
return {
158+
...c,
159+
lesson: c?.lesson
160+
?.filter(
161+
(l) => new Date(l.start) <= new Date() && l.published === ContentPublished.published
161162
)
162-
.sort((a, b) => b.weight || 99 - (a.weight || 1));
163-
}
164-
return c;
163+
.sort((a, b) => b.weight || 99 - (a.weight || 1))
164+
};
165165
})
166166
.at(0);
167167
if (!doc) {
@@ -225,7 +225,7 @@ export const getLessonFromCourseSlug = async (courseSlug: string, slug: string)
225225
...doc,
226226
// Reduce html shipped for links
227227
lesson: course?.lesson?.map((l) => {
228-
delete l.html;
228+
// delete l.html;
229229
return l;
230230
}),
231231
courseSlug: course.slug

0 commit comments

Comments
 (0)