* fix: grading input disappears on change * fix: restore mark as complete button
This commit is contained in:
@@ -27,9 +27,9 @@ export function generateQuestion(questions) {
|
|||||||
export function getIsLessonComplete(
|
export function getIsLessonComplete(
|
||||||
completions: LessonCompletion[],
|
completions: LessonCompletion[],
|
||||||
profileId: string | undefined
|
profileId: string | undefined
|
||||||
) {
|
): boolean {
|
||||||
if (!Array.isArray(completions)) return false;
|
if (!Array.isArray(completions)) return false;
|
||||||
return completions.find((c) => {
|
return completions.some((c) => {
|
||||||
return c.is_complete && c.profile_id === profileId;
|
return c.is_complete && c.profile_id === profileId;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,7 +72,7 @@
|
|||||||
</span>
|
</span>
|
||||||
</svelte:fragment>
|
</svelte:fragment>
|
||||||
</HtmlRender>
|
</HtmlRender>
|
||||||
<Grade {gradeMax} {grade} {disableGrading} />
|
<Grade {gradeMax} bind:grade {disableGrading} />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{#if code}
|
{#if code}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
export let grade: number | undefined;
|
export let grade: number | undefined;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if typeof grade === 'number'}
|
{#if typeof grade !== 'undefined'}
|
||||||
<div class="flex items-center">
|
<div class="flex items-center">
|
||||||
<TextField
|
<TextField
|
||||||
placeholder="Points"
|
placeholder="Points"
|
||||||
|
|||||||
@@ -66,15 +66,13 @@
|
|||||||
<div class="flex items-center justify-between">
|
<div class="flex items-center justify-between">
|
||||||
<HtmlRender className="mt-4">
|
<HtmlRender className="mt-4">
|
||||||
<svelte:fragment slot="content">
|
<svelte:fragment slot="content">
|
||||||
<span
|
<span class="dark:text-white flex items-center gap-1 {labelClassName}">
|
||||||
class="dark:text-white flex gap-1 {labelClassName} {typeof grade === 'number' && 'w-3/4'}"
|
|
||||||
>
|
|
||||||
<h3>{index}</h3>
|
<h3>{index}</h3>
|
||||||
<h3>{title}</h3>
|
<h3>{title}</h3>
|
||||||
</span>
|
</span>
|
||||||
</svelte:fragment>
|
</svelte:fragment>
|
||||||
</HtmlRender>
|
</HtmlRender>
|
||||||
<Grade {gradeMax} {grade} {disableGrading} />
|
<Grade {gradeMax} bind:grade {disableGrading} />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{#if code}
|
{#if code}
|
||||||
|
|||||||
@@ -44,7 +44,7 @@
|
|||||||
</span>
|
</span>
|
||||||
</svelte:fragment>
|
</svelte:fragment>
|
||||||
</HtmlRender>
|
</HtmlRender>
|
||||||
<Grade {gradeMax} {grade} {disableGrading} />
|
<Grade {gradeMax} bind:grade {disableGrading} />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{#if code}
|
{#if code}
|
||||||
|
|||||||
@@ -43,6 +43,7 @@
|
|||||||
let isLoading = false;
|
let isLoading = false;
|
||||||
let isSaving = false;
|
let isSaving = false;
|
||||||
let isStudent = true;
|
let isStudent = true;
|
||||||
|
let isLessonComplete = false;
|
||||||
|
|
||||||
function getLessonOrder(id: string) {
|
function getLessonOrder(id: string) {
|
||||||
const index = $lessons.findIndex((lesson) => lesson.id === id);
|
const index = $lessons.findIndex((lesson) => lesson.id === id);
|
||||||
@@ -211,6 +212,8 @@
|
|||||||
mode = MODES.view;
|
mode = MODES.view;
|
||||||
fetchReqData(data.lessonId, data.isMaterialsTabActive);
|
fetchReqData(data.lessonId, data.isMaterialsTabActive);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$: isLessonComplete = getIsLessonComplete($lesson.lesson_completion, $profile.id);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<CourseContainer
|
<CourseContainer
|
||||||
@@ -294,6 +297,22 @@
|
|||||||
className="overflow-x-hidden"
|
className="overflow-x-hidden"
|
||||||
>
|
>
|
||||||
<Materials lessonId={data.lessonId} {mode} {prevMode} {toggleMode} bind:isSaving />
|
<Materials lessonId={data.lessonId} {mode} {prevMode} {toggleMode} bind:isSaving />
|
||||||
|
<div class="w-full hidden lg:flex flex-row-reverse mt-10">
|
||||||
|
<PrimaryButton
|
||||||
|
onClick={() => markLessonComplete(data.lessonId)}
|
||||||
|
isLoading={isMarkingComplete}
|
||||||
|
isDisabled={isMarkingComplete}
|
||||||
|
variant={VARIANTS.OUTLINED}
|
||||||
|
className="mt-10"
|
||||||
|
>
|
||||||
|
{#if isLessonComplete}
|
||||||
|
<CheckmarkFilledIcon size={24} class="carbon-icon text-primary-600 mr-2" />
|
||||||
|
{:else}
|
||||||
|
<CheckmarkOutlineIcon size={24} class="carbon-icon mr-2" />
|
||||||
|
{/if}
|
||||||
|
Mark as {isLessonComplete ? 'Incomplete' : 'Complete'}
|
||||||
|
</PrimaryButton>
|
||||||
|
</div>
|
||||||
</PageBody>
|
</PageBody>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
@@ -330,7 +349,7 @@
|
|||||||
on:click={() => markLessonComplete(data.lessonId)}
|
on:click={() => markLessonComplete(data.lessonId)}
|
||||||
disabled={isMarkingComplete}
|
disabled={isMarkingComplete}
|
||||||
>
|
>
|
||||||
{#if getIsLessonComplete($lesson.lesson_completion, $profile.id)}
|
{#if isLessonComplete}
|
||||||
<CheckmarkFilledIcon size={24} class="carbon-icon text-primary-600" />
|
<CheckmarkFilledIcon size={24} class="carbon-icon text-primary-600" />
|
||||||
{:else}
|
{:else}
|
||||||
<CheckmarkOutlineIcon size={24} class="carbon-icon" />
|
<CheckmarkOutlineIcon size={24} class="carbon-icon" />
|
||||||
|
|||||||
@@ -156,6 +156,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
sendEmail(submissionIdData[itemToWithNewStatus.id]);
|
sendEmail(submissionIdData[itemToWithNewStatus.id]);
|
||||||
|
|
||||||
updateSubmission({
|
updateSubmission({
|
||||||
id: itemToWithNewStatus.id,
|
id: itemToWithNewStatus.id,
|
||||||
status_id: itemToWithNewStatus.statusId
|
status_id: itemToWithNewStatus.statusId
|
||||||
|
|||||||
Reference in New Issue
Block a user