diff --git a/components/Card.vue b/components/Card.vue index 1d18c5c..81528d6 100644 --- a/components/Card.vue +++ b/components/Card.vue @@ -165,7 +165,7 @@ const projectItems: { label: string | string[], type: string, rating?: ProjectRa @@ -210,7 +210,7 @@ const projectItems: { label: string | string[], type: string, rating?: ProjectRa diff --git a/components/Project/ProjectHeading.vue b/components/Project/ProjectHeading.vue index 13523bd..93dd145 100644 --- a/components/Project/ProjectHeading.vue +++ b/components/Project/ProjectHeading.vue @@ -215,7 +215,7 @@ const logo = props.project?.logos?.at(0)?.url

- {{ project.compliance ? 'YES' : 'NO' }} + {{ project.compliance ? project.compliance : 'NO' }} { diff --git a/composables/useData.ts b/composables/useData.ts index bd3d524..afe20af 100644 --- a/composables/useData.ts +++ b/composables/useData.ts @@ -233,6 +233,7 @@ export const useData = defineStore('data', () => { const generateProjectRating = (project: Project) => { const projectRatings: ProjectRating[] = ranks.value?.map((rank) => { let rankPoints = 0 + let maxPoints = 0 const ratingStats: ProjectRatingItem[] = rank.references?.map((ref) => { let isValid = false @@ -240,6 +241,7 @@ export const useData = defineStore('data', () => { let value let positive + let negative if (ref.condition.minLength !== undefined) { value = (field as any[])?.length @@ -259,12 +261,17 @@ export const useData = defineStore('data', () => { if (value !== undefined) isValid = !!value } + if (ref.field === 'compliance') { + negative = value + } + rankPoints += isValid ? ref.points : 0 + maxPoints += ref.points return { isValid, label: ref.label.name, positive: positive ? positive : ref.label.positive, - negative: ref.label.negative, + negative: negative ? negative : ref.label.negative, value, } as ProjectRatingItem }) @@ -273,6 +280,7 @@ export const useData = defineStore('data', () => { name: rank.name, items: ratingStats, points: rankPoints, + percentagePoints: rankPoints / maxPoints * 100, } }) diff --git a/types/project.ts b/types/project.ts index d5aa58f..fabb1b7 100644 --- a/types/project.ts +++ b/types/project.ts @@ -165,6 +165,7 @@ export interface ProjectRating { name: string items: ProjectRatingItem[] points: number + percentagePoints: number } export interface ProjectRatingItem {