feat: Introduce core API routes for city data, history, authentication, and payments, along with a new frontend dashboard utility file.

This commit is contained in:
2569718930@qq.com
2026-03-24 00:04:24 +08:00
parent 578e50b2da
commit 5e83a5cca3
2 changed files with 52 additions and 11 deletions
+12 -8
View File
@@ -1339,19 +1339,23 @@ export function getHistorySummary(
? row.date < cityLocalDate
: row.date < new Date().toISOString().slice(0, 10);
});
const comparableSettledData = settledData.filter((row) => {
const actual = toFinite(row.actual);
const deb = toFinite(row.deb);
return actual != null && deb != null;
});
let hits = 0;
const debErrors: number[] = [];
const modelErrors: Record<string, number[]> = {};
settledData.forEach((row) => {
comparableSettledData.forEach((row) => {
const actual = toFinite(row.actual);
const deb = toFinite(row.deb);
if (actual != null && deb != null) {
debErrors.push(Math.abs(actual - deb));
if (wuRound(actual) === wuRound(deb)) {
hits += 1;
}
if (actual == null || deb == null) return;
debErrors.push(Math.abs(actual - deb));
if (wuRound(actual) === wuRound(deb)) {
hits += 1;
}
const forecasts = row.forecasts || {};
@@ -1389,7 +1393,7 @@ export function getHistorySummary(
let debWinDaysVsBest = 0;
let debVsBestComparableDays = 0;
if (bestModelName) {
settledData.forEach((row) => {
comparableSettledData.forEach((row) => {
const actual = toFinite(row.actual);
const deb = toFinite(row.deb);
const bestModelVal = toFinite(row.forecasts?.[bestModelName]);
@@ -1430,7 +1434,7 @@ export function getHistorySummary(
: null,
mgms: recentData.map((row) => row.mgm ?? null),
recentData,
settledCount: settledData.length,
settledCount: comparableSettledData.length,
actuals: recentData.map((row) => row.actual),
};
}