Merge pull request #53 from web3privacy/dw/bug-fixes

fix: remove console log
This commit is contained in:
MufCZ 2024-10-03 16:49:18 +02:00 committed by GitHub
commit a00ed6b685
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -61,16 +61,18 @@ export const useData = defineStore('data', () => {
ranks: Rank[] ranks: Rank[]
}>('/api/data') }>('/api/data')
data.projects.forEach(project => project.ratings = generateProjectRating(project)) data.projects.forEach(project => project.ratings = generateProjectRating(project))
// Percentage calculation
projects.value = data.projects.map((project) => { projects.value = data.projects.map((project) => {
const totalPoints = project.ratings?.reduce((a, b) => a + b.percentagePoints, 0) || 0 const totalPoints = project.ratings?.reduce((a, b) => a + b.percentagePoints, 0) || 0
const numberOfRatings = project.ratings?.length || 1 // Avoid division by zero const numberOfRatings = project.ratings?.length || 1
const averagePercentage = totalPoints / numberOfRatings const averagePercentage = totalPoints / numberOfRatings
return { return {
...project, ...project,
percentage: Math.min(Math.max(Math.round(averagePercentage), 0), 100), // Ensure within 0-100% percentage: Math.min(Math.max(Math.round(averagePercentage), 0), 100),
} }
}).filter(p => p.name) }).filter(p => p.name)
console.log(projects.value.filter(p => p.name === 'ETHBerlin'))
const projectCategories = projects.value.map(p => p.categories).flat() const projectCategories = projects.value.map(p => p.categories).flat()
categories.value = data.categories.filter(c => projectCategories.includes(c.id)) categories.value = data.categories.filter(c => projectCategories.includes(c.id))
usecases.value = data.usecases usecases.value = data.usecases