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