From 7160fa5cf8868fc3fa2722e0e8159fce91fb1c4e Mon Sep 17 00:00:00 2001 From: rotimi-best Date: Mon, 13 Sep 2021 13:11:25 +0300 Subject: [PATCH] Fix materials not adding --- .../Course/components/Lesson/Materials/index.svelte | 8 ++++---- src/components/Course/components/Lesson/store/lessons.js | 8 +++++++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/components/Course/components/Lesson/Materials/index.svelte b/src/components/Course/components/Lesson/Materials/index.svelte index b63334d4..bbb50c60 100644 --- a/src/components/Course/components/Lesson/Materials/index.svelte +++ b/src/components/Course/components/Lesson/Materials/index.svelte @@ -70,14 +70,14 @@ badgeValue = !!note ? 1 : 0; } else { badgeValue = - typeof video_url === 'string' ? video_url.split(',').length : 0; + typeof video_url === 'string' && !!video_url + ? video_url.split(',').length + : 0; } tab.badgeValue = badgeValue; return tab; }); - - console.log(`tabs`, tabs); } $: handleSave(prevMode); @@ -138,7 +138,7 @@ bind:value={$lesson.materials.video_url} onChange={() => ($isLessonDirty = true)} /> - {:else if $lesson.materials.video_url && $lesson.materials.video_url.includes('youtube')} + {:else if !!$lesson.materials.video_url && $lesson.materials.video_url.includes('youtube')} {#each $lesson.materials.video_url.split(',') as url}