mirror of
https://github.com/web3privacy/explorer-app.git
synced 2024-10-15 16:46:26 +02:00
Merge pull request #45 from web3privacy/dk/fix-rating-condition
fix(rating): condition if exists is false
This commit is contained in:
commit
5ed800eac3
3 changed files with 9 additions and 3 deletions
|
@ -59,7 +59,7 @@ defineProps<{
|
|||
</NuxtLink>
|
||||
</ProjectInfoItem>
|
||||
<ProjectInfoItem
|
||||
:check-undefined="project.compliance"
|
||||
:check-undefined="true"
|
||||
color="#FFB800"
|
||||
bold
|
||||
title="Compliance with"
|
||||
|
|
|
@ -27,6 +27,8 @@ const colors = [
|
|||
]
|
||||
|
||||
const backgroundColorByScore = computed(() => {
|
||||
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]
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue