refact(rating): label interface and usage

This commit is contained in:
Daniel Klein 2024-09-17 09:05:34 +02:00
parent da00ab91c2
commit c35e1cf99a
2 changed files with 10 additions and 8 deletions

View file

@ -224,7 +224,7 @@ export const useData = defineStore('data', () => {
value = (field as any[])?.length
if (value) {
isValid = value >= ref.condition.minLength
positive = `${value} ${ref.positive}${value > 1 ? 's' : ''}`
positive = `${value} ${ref.label.positive}${value > 1 ? 's' : ''}`
}
}
if (ref.condition.equals) {
@ -241,11 +241,11 @@ export const useData = defineStore('data', () => {
rankPoints += isValid ? ref.points : 0
return {
isValid,
label: ref.label,
positive: positive ? positive : ref.positive,
negative: ref.negative,
label: ref.label.name,
positive: positive ? positive : ref.label.positive,
negative: ref.label.negative,
value,
}
} as ProjectRatingItem
})
return {
type: rank.id,

View file

@ -8,9 +8,11 @@ export interface Rank {
interface Reference {
field: keyof Project
label: string
positive: string
negative: string
label: {
name: string
positive: string
negative: string
}
condition: Condition
points: number
}