chore: add prettier with config and format all files

This commit is contained in:
Sebastian Seedorf
2026-06-04 11:44:20 +02:00
parent d212ae3f30
commit cf9bb33ecb
50 changed files with 1290 additions and 714 deletions

View File

@@ -6,7 +6,7 @@ export const GET = withAuth(async (req: NextRequest) => {
const p = req.nextUrl.searchParams;
const combinator = p.get('combinator');
const from = p.get('from') ? new Date(p.get('from')!) : new Date(Date.now() - 86_400_000);
const to = p.get('to') ? new Date(p.get('to')!) : new Date();
const to = p.get('to') ? new Date(p.get('to')!) : new Date();
const conditions = ['real_time BETWEEN $1 AND $2'];
const values: unknown[] = [from, to];
@@ -17,7 +17,9 @@ export const GET = withAuth(async (req: NextRequest) => {
}
const result = await pool.query<{
real_time: Date; game_tick: string; combinator: string;
real_time: Date;
game_tick: string;
combinator: string;
}>(
`SELECT real_time, game_tick, combinator
FROM tick_timing
@@ -43,17 +45,17 @@ export const GET = withAuth(async (req: NextRequest) => {
const prev = combiRows[i - 1];
const curr = combiRows[i];
const deltaRealMs = curr.real_time.getTime() - prev.real_time.getTime();
const deltaTicks = parseInt(curr.game_tick, 10) - parseInt(prev.game_tick, 10);
const deltaTicks = parseInt(curr.game_tick, 10) - parseInt(prev.game_tick, 10);
// Skip session gaps and bad data
if (deltaRealMs > 30 * 60 * 1000 || deltaRealMs <= 0 || deltaTicks <= 0) continue;
points.push({
real_time: curr.real_time.toISOString(),
game_tick: parseInt(curr.game_tick, 10),
real_time: curr.real_time.toISOString(),
game_tick: parseInt(curr.game_tick, 10),
combinator: combi,
ups: Math.round((deltaTicks / deltaRealMs) * 1000 * 10) / 10,
ups: Math.round((deltaTicks / deltaRealMs) * 1000 * 10) / 10,
});
}
}
return NextResponse.json(points);
});
});