fix(dashboard): "Gestern im Team" war immer leer (ENTWICKLUN-13)
Der Vortags-Feed verlangte published_at IS NOT NULL, gesetzt nur vom Cron publish-day-entries. Auf Prod ist dieser Cron nicht eingeplant (keine crontab/ kein Scheduler) → published_at blieb bei allen echten Reflexionen null → Feed immer leer (auf Dev sah's gut aus, weil der Seed published_at setzt). Feed jetzt vom Cron entkoppelt: zeigt volle Reflexionen mit Datum < heute (heutige bleiben privat bis morgen), sortiert nach Datum/Reflexionszeit. Gilt für dashboard.overview.feed und dayEntry.feed. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
8fd72bcb69
commit
c3d3c4500e
2 files changed
+11
-6
No files matched your search
@@ -1,4 +1,4 @@
|
||||
import { and, eq, ne, isNotNull, isNull, count, desc } from 'drizzle-orm';
|
||||
import { and, eq, ne, isNull, lt, count, desc } from 'drizzle-orm';
|
||||
import { area, project, blocker, dayEntry, user, risk, type Area, type Project } from '@cockpit/db';
|
||||
import { router, protectedProcedure } from '../trpc.js';
|
||||
import { todayIso, previousWerktag } from '../lib/werktag.js';
|
||||
@@ -30,8 +30,10 @@ export const dashboardRouter = router({
|
||||
})
|
||||
.from(dayEntry)
|
||||
.innerJoin(user, eq(user.id, dayEntry.userId))
|
||||
.where(and(isNotNull(dayEntry.publishedAt), eq(dayEntry.status, 'full')))
|
||||
.orderBy(desc(dayEntry.publishedAt))
|
||||
// „Gestern im Team": volle Reflexionen vor heute (heutige bleiben privat
|
||||
// bis morgen). Unabhängig vom publish-Cron.
|
||||
.where(and(lt(dayEntry.date, todayDate), eq(dayEntry.status, 'full')))
|
||||
.orderBy(desc(dayEntry.date), desc(dayEntry.reflectedAt))
|
||||
.limit(50),
|
||||
ctx.db
|
||||
.select({
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { TRPCError } from '@trpc/server';
|
||||
import { and, eq, isNull, isNotNull, lt, asc, desc, inArray } from 'drizzle-orm';
|
||||
import { and, eq, isNull, lt, asc, desc, inArray } from 'drizzle-orm';
|
||||
import { dayEntry, todo, blocker, type Todo } from '@cockpit/db';
|
||||
import { DayEntrySchemas } from '@cockpit/shared';
|
||||
import { router, protectedProcedure } from '../trpc.js';
|
||||
@@ -371,11 +371,14 @@ export const dayEntryRouter = router({
|
||||
* Nutzbar in Story 3.4 (Dashboard-Feed).
|
||||
*/
|
||||
feed: protectedProcedure.query(async ({ ctx }) => {
|
||||
// Volle Reflexionen vor heute (heutige bleiben privat bis morgen) —
|
||||
// unabhängig vom publish-Cron.
|
||||
const today = todayIso();
|
||||
const entries = await ctx.db
|
||||
.select()
|
||||
.from(dayEntry)
|
||||
.where(isNotNull(dayEntry.publishedAt))
|
||||
.orderBy(desc(dayEntry.publishedAt))
|
||||
.where(and(lt(dayEntry.date, today), eq(dayEntry.status, 'full')))
|
||||
.orderBy(desc(dayEntry.date), desc(dayEntry.reflectedAt))
|
||||
.limit(50);
|
||||
return entries;
|
||||
}),
|
||||
|
||||
Reference in new issue
Block a user