Include planning as active projects and award achievements on dashboard load

cgen-fc66386207d4407e9977fc3b529c4264
This commit is contained in:
Builder.io 2025-09-27 22:00:51 +00:00
parent 38367daebe
commit 22b8009ceb

View file

@ -103,6 +103,13 @@ export default function Dashboard() {
setProjects([]);
}
// Check and award project-related achievements, then load achievements
try {
await aethexAchievementService.checkAndAwardProjectAchievements(user!.id);
} catch (e) {
console.warn("checkAndAwardProjectAchievements failed:", e);
}
// Load user's achievements with error handling
let userAchievements = [];
try {
@ -115,9 +122,9 @@ export default function Dashboard() {
setAchievements([]);
}
// Calculate stats
// Calculate stats (treat planning and in_progress as active)
const activeCount = userProjects.filter(
(p) => p.status === "in_progress",
(p) => p.status === "in_progress" || p.status === "planning",
).length;
const completedCount = userProjects.filter(
(p) => p.status === "completed",