fix(rating): boolean conditions

This commit is contained in:
Daniel Klein 2024-09-20 12:13:27 +02:00
parent 476e392c9d
commit 23a212686a
4 changed files with 4153 additions and 1840 deletions

View file

@ -228,22 +228,22 @@ export const useData = defineStore('data', () => {
let value let value
let positive let positive
if (ref.condition.minLength) { if (ref.condition.minLength !== undefined) {
value = (field as any[])?.length value = (field as any[])?.length
if (value) { if (value) {
isValid = value >= ref.condition.minLength isValid = value >= ref.condition.minLength
positive = `${value} ${ref.label.positive}${value > 1 ? 's' : ''}` positive = `${value} ${ref.label.positive}${value > 1 ? 's' : ''}`
} }
} }
if (ref.condition.equals) { if (ref.condition.equals !== undefined) {
value = field value = field
if (value) if (value !== undefined)
isValid = value === ref.condition.equals isValid = value === ref.condition.equals
} }
if (ref.condition.exists) { if (ref.condition.exists !== undefined) {
value = field value = field
if (value) if (value !== undefined)
isValid = !!value isValid = !!value
} }
rankPoints += isValid ? ref.points : 0 rankPoints += isValid ? ref.points : 0

File diff suppressed because it is too large Load diff

View file

@ -11,7 +11,7 @@ export interface Project {
ecosystem?: string[] ecosystem?: string[]
product_readiness?: string product_readiness?: string
security?: string security?: string
have_token?: boolean have_token: boolean
token_link?: string token_link?: string
assets_used?: string[] assets_used?: string[]
tokens?: { tokens?: {
@ -57,44 +57,44 @@ export interface Project {
[k: string]: unknown [k: string]: unknown
} }
blockchain_features?: { blockchain_features?: {
p2p?: boolean p2p: boolean
encryption?: string encryption?: string
network?: string network?: string
upgradability?: { upgradability?: {
enabled?: boolean enabled: boolean
type?: string type?: string
admin_keys?: string admin_keys?: string
[k: string]: unknown [k: string]: unknown
} }
[k: string]: unknown [k: string]: unknown
opensource: boolean opensource: boolean
viewing_key?: boolean viewing_key: boolean
dissapearing_tx?: boolean dissapearing_tx: boolean
frontend_anonymity?: string frontend_anonymity?: string
identity_integration?: null identity_integration?: null
connected_tx?: boolean connected_tx: boolean
revealed_recipient?: boolean revealed_recipient: boolean
revealed_sender?: boolean revealed_sender: boolean
revealed_ammount?: boolean revealed_ammount: boolean
reversability_condition?: string reversability_condition?: string
data_masking?: string data_masking?: string
asset_custody_type?: string asset_custody_type?: string
} }
licences?: string licences?: string
privacy_policy?: { privacy_policy: {
defined?: boolean defined: boolean
link?: string link?: string
data_usage?: string data_usage?: string
[k: string]: unknown [k: string]: unknown
} }
team?: Team team?: Team
storage?: { storage?: {
decentralized?: boolean decentralized: boolean
[k: string]: unknown [k: string]: unknown
} }
tracebility?: { tracebility?: {
tracked_data?: string tracked_data?: string
kyc?: boolean kyc: boolean
sign_in_type_requirments?: string[] sign_in_type_requirments?: string[]
[k: string]: unknown [k: string]: unknown
} }
@ -115,10 +115,10 @@ export interface Project {
default_privacy?: boolean default_privacy?: boolean
funding?: Fund[] funding?: Fund[]
project_status?: { project_status?: {
live_status?: boolean live_status: boolean
version?: string version?: string
testnet?: boolean testnet: boolean
mainnet?: boolean mainnet: boolean
[k: string]: unknown [k: string]: unknown
} }
logos?: { logos?: {