From c6ede6ec323298a8a3a9458ac1d4c1ba49eb2c1a Mon Sep 17 00:00:00 2001 From: Daniel Klein Date: Wed, 25 Sep 2024 21:03:08 +0200 Subject: [PATCH] fix(rating): condition if exists is false --- components/Project/ProjectPrivacy.vue | 2 +- components/Project/ProjectRating.vue | 2 ++ composables/useData.ts | 8 ++++++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/components/Project/ProjectPrivacy.vue b/components/Project/ProjectPrivacy.vue index 1307fb6..ed534f9 100644 --- a/components/Project/ProjectPrivacy.vue +++ b/components/Project/ProjectPrivacy.vue @@ -59,7 +59,7 @@ defineProps<{ { + if (props.percentage === 100) + return '#42FF00' const normalizedPercentage = Math.min(Math.max(props.percentage, 0), 100) const colorIndex = Math.floor(normalizedPercentage / 10) return colors[colorIndex] diff --git a/composables/useData.ts b/composables/useData.ts index afe20af..484383e 100644 --- a/composables/useData.ts +++ b/composables/useData.ts @@ -258,8 +258,11 @@ export const useData = defineStore('data', () => { if (ref.condition.exists !== undefined) { value = field - if (value !== undefined) - isValid = !!value + + if (ref.condition.exists === false) + isValid = !value ? true : false + else + isValid = value ? true : false } if (ref.field === 'compliance') { negative = value @@ -267,6 +270,7 @@ export const useData = defineStore('data', () => { rankPoints += isValid ? ref.points : 0 maxPoints += ref.points + return { isValid, label: ref.label.name,