fix(score): fix score calculation synchronisation with rating being generated

This commit is contained in:
Daniel Klein 2024-09-18 21:16:35 +02:00
parent 6830e499cd
commit 6f70344af4

View file

@ -60,9 +60,9 @@ export const useData = defineStore('data', () => {
features: Feature[] features: Feature[]
ranks: Rank[] ranks: Rank[]
}>('/api/data') }>('/api/data')
data.projects.forEach(project => project.ratings = generateProjectRating(project))
projects.value = data.projects.map(project => ({ projects.value = data.projects.map(project => ({
...project, ...project,
ratings: generateProjectRating(project),
percentage: Math.round((project.ratings?.reduce((a, b) => a + b.points, 0) || 0) / 1.5), percentage: Math.round((project.ratings?.reduce((a, b) => a + b.points, 0) || 0) / 1.5),
})).filter(p => p.name) })).filter(p => p.name)