Add debug logging for dailyLog query
All checks were successful
Deploy / deploy (push) Successful in 2m39s
All checks were successful
Deploy / deploy (push) Successful in 2m39s
This commit is contained in:
@@ -75,12 +75,23 @@ export const GET = withAuth(async (_request, user, pb) => {
|
||||
let biometrics = { ...DEFAULT_BIOMETRICS, phaseLimit };
|
||||
try {
|
||||
const today = new Date().toISOString().split("T")[0];
|
||||
logger.info({ userId: user.id, today }, "Fetching dailyLog");
|
||||
const dailyLog = await pb
|
||||
.collection("dailyLogs")
|
||||
.getFirstListItem<DailyLog>(`user="${user.id}" && date~"${today}"`, {
|
||||
sort: "-created",
|
||||
});
|
||||
|
||||
logger.info(
|
||||
{
|
||||
userId: user.id,
|
||||
dailyLogId: dailyLog.id,
|
||||
hrvStatus: dailyLog.hrvStatus,
|
||||
bodyBatteryCurrent: dailyLog.bodyBatteryCurrent,
|
||||
},
|
||||
"Found dailyLog",
|
||||
);
|
||||
|
||||
biometrics = {
|
||||
hrvStatus: dailyLog.hrvStatus,
|
||||
bodyBatteryCurrent:
|
||||
@@ -91,8 +102,8 @@ export const GET = withAuth(async (_request, user, pb) => {
|
||||
weekIntensityMinutes: dailyLog.weekIntensityMinutes,
|
||||
phaseLimit: dailyLog.phaseLimit,
|
||||
};
|
||||
} catch {
|
||||
// No daily log found - use defaults
|
||||
} catch (err) {
|
||||
logger.warn({ userId: user.id, err }, "No dailyLog found, using defaults");
|
||||
}
|
||||
|
||||
// Build DailyData for decision engine
|
||||
|
||||
Reference in New Issue
Block a user