Fix profiles
This commit is contained in:
parent
dbd0f84c5f
commit
c55be997dc
|
|
@ -48,7 +48,7 @@ const openInCircle = (assignment: CompetenceCertificateAssignment) => {
|
||||||
v-if="showCourseSession"
|
v-if="showCourseSession"
|
||||||
:data-cy="`assignment-${assignment.slug}-course-session`"
|
:data-cy="`assignment-${assignment.slug}-course-session`"
|
||||||
>
|
>
|
||||||
{{ assignment?.completions[0]?.course_session.title }}
|
{{ assignment?.completions?.[0]?.course_session.title }}
|
||||||
</p>
|
</p>
|
||||||
<p class="text-gray-800">
|
<p class="text-gray-800">
|
||||||
<button
|
<button
|
||||||
|
|
@ -69,7 +69,7 @@ const openInCircle = (assignment: CompetenceCertificateAssignment) => {
|
||||||
</div>
|
</div>
|
||||||
<div class="grow lg:px-8">
|
<div class="grow lg:px-8">
|
||||||
<div
|
<div
|
||||||
v-if="assignment.completions[0]?.completion_status === 'EVALUATION_SUBMITTED'"
|
v-if="assignment.completions?.[0]?.completion_status === 'EVALUATION_SUBMITTED'"
|
||||||
class="flex items-center"
|
class="flex items-center"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
|
|
@ -82,7 +82,7 @@ const openInCircle = (assignment: CompetenceCertificateAssignment) => {
|
||||||
<div
|
<div
|
||||||
v-else-if="
|
v-else-if="
|
||||||
['EVALUATION_IN_PROGRESS', 'SUBMITTED'].includes(
|
['EVALUATION_IN_PROGRESS', 'SUBMITTED'].includes(
|
||||||
assignment.completions[0]?.completion_status || ''
|
assignment.completions?.[0]?.completion_status || ''
|
||||||
)
|
)
|
||||||
"
|
"
|
||||||
class="flex items-center"
|
class="flex items-center"
|
||||||
|
|
@ -97,7 +97,7 @@ const openInCircle = (assignment: CompetenceCertificateAssignment) => {
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<div
|
<div
|
||||||
v-if="assignment.completions[0]?.completion_status === 'EVALUATION_SUBMITTED'"
|
v-if="assignment.completions?.[0]?.completion_status === 'EVALUATION_SUBMITTED'"
|
||||||
class="flex flex-col lg:items-center"
|
class="flex flex-col lg:items-center"
|
||||||
>
|
>
|
||||||
<div class="flex flex-col lg:items-center">
|
<div class="flex flex-col lg:items-center">
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ const userGradeRounded2Places = computed(() => {
|
||||||
|
|
||||||
const numAssignmentsEvaluated = computed(() => {
|
const numAssignmentsEvaluated = computed(() => {
|
||||||
return props.competenceCertificate.assignments.filter((a) => {
|
return props.competenceCertificate.assignments.filter((a) => {
|
||||||
return a.completions[0]?.completion_status === "EVALUATION_SUBMITTED";
|
return a?.completions?.[0]?.completion_status === "EVALUATION_SUBMITTED";
|
||||||
}).length;
|
}).length;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -57,7 +57,7 @@ const showCourseSession = computed(() => {
|
||||||
const currentCourseSession = useCurrentCourseSession();
|
const currentCourseSession = useCurrentCourseSession();
|
||||||
return props.competenceCertificate.assignments.some((assignment) => {
|
return props.competenceCertificate.assignments.some((assignment) => {
|
||||||
return (
|
return (
|
||||||
assignment.completions[0]?.course_session.title !==
|
assignment.completions?.[0]?.course_session.title !==
|
||||||
currentCourseSession.value.title
|
currentCourseSession.value.title
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ const userPointsEvaluatedAssignments = computed(() => {
|
||||||
|
|
||||||
const numAssignmentsEvaluated = computed(() => {
|
const numAssignmentsEvaluated = computed(() => {
|
||||||
return (assignments.value ?? []).filter((a) => {
|
return (assignments.value ?? []).filter((a) => {
|
||||||
return a.completions[0]?.completion_status === "EVALUATION_SUBMITTED";
|
return a.completions?.[0]?.completion_status === "EVALUATION_SUBMITTED";
|
||||||
}).length;
|
}).length;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,8 +17,8 @@ export function assignmentsMaxEvaluationPoints(
|
||||||
export function assignmentsUserPoints(assignments: CompetenceCertificateAssignment[]) {
|
export function assignmentsUserPoints(assignments: CompetenceCertificateAssignment[]) {
|
||||||
return +_.sum(
|
return +_.sum(
|
||||||
assignments
|
assignments
|
||||||
.filter((a) => a.completions[0]?.completion_status === "EVALUATION_SUBMITTED")
|
.filter((a) => a.completions?.[0]?.completion_status === "EVALUATION_SUBMITTED")
|
||||||
.map((a) => a.completions[0]?.evaluation_points_final ?? 0)
|
.map((a) => a.completions?.[0]?.evaluation_points_final ?? 0)
|
||||||
).toFixed(1);
|
).toFixed(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -27,12 +27,12 @@ export function calcCompetenceCertificateGrade(
|
||||||
roundedToHalfGrade = true
|
roundedToHalfGrade = true
|
||||||
) {
|
) {
|
||||||
const evaluatedAssignments = assignments.filter(
|
const evaluatedAssignments = assignments.filter(
|
||||||
(a) => a.completions[0]?.completion_status === "EVALUATION_SUBMITTED"
|
(a) => a.completions?.[0]?.completion_status === "EVALUATION_SUBMITTED"
|
||||||
);
|
);
|
||||||
|
|
||||||
const adjustedResults = evaluatedAssignments.map((a) => {
|
const adjustedResults = evaluatedAssignments.map((a) => {
|
||||||
return (
|
return (
|
||||||
((a.completions[0]?.evaluation_points_final ?? 0) / a.max_points) *
|
((a.completions?.[0]?.evaluation_points_final ?? 0) / a.max_points) *
|
||||||
a.competence_certificate_weight
|
a.competence_certificate_weight
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
@ -77,7 +77,7 @@ export function competenceCertificateProgressStatusCount(
|
||||||
assignments: CompetenceCertificateAssignment[]
|
assignments: CompetenceCertificateAssignment[]
|
||||||
) {
|
) {
|
||||||
const numAssignmentsEvaluated = assignments.filter(
|
const numAssignmentsEvaluated = assignments.filter(
|
||||||
(a) => a.completions[0]?.completion_status === "EVALUATION_SUBMITTED"
|
(a) => a.completions?.[0]?.completion_status === "EVALUATION_SUBMITTED"
|
||||||
).length;
|
).length;
|
||||||
return {
|
return {
|
||||||
SUCCESS: numAssignmentsEvaluated,
|
SUCCESS: numAssignmentsEvaluated,
|
||||||
|
|
@ -120,8 +120,8 @@ export function mergeCompetenceCertificates(
|
||||||
if (!existingAssignment) {
|
if (!existingAssignment) {
|
||||||
mergedCertificate.assignments.push(assignment);
|
mergedCertificate.assignments.push(assignment);
|
||||||
} else if (
|
} else if (
|
||||||
assignment.completions[0] != null &&
|
assignment.completions?.[0] != null &&
|
||||||
(existingAssignment.completions[0] == null ||
|
(existingAssignment.completions?.[0] == null ||
|
||||||
dayjs(existingAssignment.completions[0].evaluation_submitted_at).isBefore(
|
dayjs(existingAssignment.completions[0].evaluation_submitted_at).isBefore(
|
||||||
assignment.completions[0].evaluation_submitted_at
|
assignment.completions[0].evaluation_submitted_at
|
||||||
))
|
))
|
||||||
|
|
|
||||||
|
|
@ -408,7 +408,7 @@ watch(selectedRegion, () => {
|
||||||
v-if="
|
v-if="
|
||||||
(['SUPERVISOR', 'EXPERT'].includes(cs.my_role) &&
|
(['SUPERVISOR', 'EXPERT'].includes(cs.my_role) &&
|
||||||
cs.user_role === 'MEMBER') ||
|
cs.user_role === 'MEMBER') ||
|
||||||
(cs.my_role === 'LEARNING_MENTOR' &&
|
(['LEARNING_MENTOR', 'BERUFSBILDNER'].includes(cs.my_role) &&
|
||||||
cs.user_role === 'PARTICIPANT')
|
cs.user_role === 'PARTICIPANT')
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ function userGrade(userId: string) {
|
||||||
);
|
);
|
||||||
for (const assignment of assignmentsWithUserCompletions) {
|
for (const assignment of assignmentsWithUserCompletions) {
|
||||||
assignment.completions = assignment.completions?.filter(
|
assignment.completions = assignment.completions?.filter(
|
||||||
(c) => c?.assignment_user.id === userId
|
(c) => c?.assignment_user?.id === userId
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue