Fix bug of adding tutor to lesson

This commit is contained in:
rotimi-best
2021-08-26 09:34:18 +03:00
parent 1b7fbaacf6
commit 26798f1e93
8 changed files with 50 additions and 50 deletions
+1 -3
View File
@@ -83,8 +83,6 @@
const { data } = await fetchCourse(courseId);
setCourseData(data);
});
$: console.log(`$lessons`, $lessons);
</script>
<CourseContainer>
@@ -169,7 +167,7 @@
{#if lessonEditing === index}
<Select
bind:value={lesson.profile}
options={[...$group.tutors.filter((t) => !!t.profile)]}
options={$group.tutors}
labelKey="fullname"
/>
{:else if !lesson.profile}
+13 -8
View File
@@ -25,8 +25,7 @@
function setPeople(group) {
if (!group) return;
const { students, tutors } = group;
people = [...students, ...tutors].sort((a, b) => a.role_id - b.role_id);
people = (group.people || []).sort((a, b) => a.role_id - b.role_id);
console.log(`group changed`, group);
}
@@ -71,19 +70,25 @@
<!-- <span class="flex-grow" /> -->
{#if person.profile}
<p class="text-lg w-1/4 break-all">{person.profile.fullname}</p>
<a
href="mailto:{person.profile.email}"
class="text-md w-1/4 mx-2 text-blue-600"
>
{person.profile.email}
</a>
{:else}
<p
class="bg-yellow-500 w-1/4 text-sm text-center rounded-xl text-white"
>
Pending Invite
</p>
<a
href="mailto:{person.email}"
class="text-md w-1/4 mx-2 text-blue-600"
>
{person.email}
</a>
{/if}
<a
href="mailto:{person.email}"
class="text-md w-1/4 mx-2 text-blue-600"
>
{person.email}
</a>
<p class="text-lg w-1/4 ">{ROLE_LABEL[person.role_id]}</p>
</div>
{/each}