fix: restore WeatherAverageBar component in session header and adjust styling
All checks were successful
Deploy with Docker Compose / deploy (push) Successful in 6m12s
All checks were successful
Deploy with Docker Compose / deploy (push) Successful in 6m12s
Reintroduced the WeatherAverageBar component in the WeatherSessionPage to display team averages. Updated the styling of the WeatherAverageBar for improved spacing. Enhanced the EvolutionIndicator component to use dynamic background colors for better visibility of status indicators.
This commit is contained in:
@@ -203,17 +203,25 @@ export async function getPreviousWeatherEntriesForUsers(
|
||||
sessionId: { not: excludeSessionId },
|
||||
session: { date: { lt: sessionDate } },
|
||||
},
|
||||
orderBy: [{ userId: 'asc' }, { session: { date: 'desc' } }],
|
||||
select: {
|
||||
userId: true,
|
||||
performanceEmoji: true,
|
||||
moralEmoji: true,
|
||||
fluxEmoji: true,
|
||||
valueCreationEmoji: true,
|
||||
session: { select: { date: true } },
|
||||
},
|
||||
});
|
||||
|
||||
// Keep only the most recent entry per user (first occurrence since ordered by date desc)
|
||||
// Sort by session.date desc (Prisma orderBy on relation is unreliable with SQLite)
|
||||
entries.sort((a, b) => {
|
||||
const dateA = a.session.date.getTime();
|
||||
const dateB = b.session.date.getTime();
|
||||
if (dateB !== dateA) return dateB - dateA; // most recent first
|
||||
return a.userId.localeCompare(b.userId);
|
||||
});
|
||||
|
||||
// For each user, use the most recent previous value PER AXIS (fallback if latest session has null)
|
||||
const map = new Map<
|
||||
string,
|
||||
{
|
||||
@@ -224,14 +232,19 @@ export async function getPreviousWeatherEntriesForUsers(
|
||||
}
|
||||
>();
|
||||
for (const entry of entries) {
|
||||
if (!map.has(entry.userId)) {
|
||||
map.set(entry.userId, {
|
||||
performanceEmoji: entry.performanceEmoji,
|
||||
moralEmoji: entry.moralEmoji,
|
||||
fluxEmoji: entry.fluxEmoji,
|
||||
valueCreationEmoji: entry.valueCreationEmoji,
|
||||
});
|
||||
}
|
||||
const existing = map.get(entry.userId);
|
||||
const base = existing ?? {
|
||||
performanceEmoji: null as string | null,
|
||||
moralEmoji: null as string | null,
|
||||
fluxEmoji: null as string | null,
|
||||
valueCreationEmoji: null as string | null,
|
||||
};
|
||||
if (!existing) map.set(entry.userId, base);
|
||||
if (base.performanceEmoji == null && entry.performanceEmoji != null) base.performanceEmoji = entry.performanceEmoji;
|
||||
if (base.moralEmoji == null && entry.moralEmoji != null) base.moralEmoji = entry.moralEmoji;
|
||||
if (base.fluxEmoji == null && entry.fluxEmoji != null) base.fluxEmoji = entry.fluxEmoji;
|
||||
if (base.valueCreationEmoji == null && entry.valueCreationEmoji != null)
|
||||
base.valueCreationEmoji = entry.valueCreationEmoji;
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user