chore: 添加保存调试日志、修复 time-tracking 类型、简化首页

This commit is contained in:
2026-03-13 18:39:08 +08:00
parent 371d4ce327
commit 96390df254
4 changed files with 14 additions and 60 deletions

View File

@@ -183,7 +183,7 @@ class SessionPersistenceService implements SessionPersistence {
try {
const content = await fs.readFile(filePath, 'utf-8')
const data = JSON.parse(content)
data.activeDays = Object.values(data.days).filter(d => d.totalDuration > 0).length
data.activeDays = Object.values(data.days).filter((d: any) => d.totalDuration > 0).length
return data
} catch (err) {
return createEmptyMonthData(year, month)
@@ -195,7 +195,7 @@ class SessionPersistenceService implements SessionPersistence {
try {
const content = await fs.readFile(filePath, 'utf-8')
const data = JSON.parse(content)
data.totalActiveDays = Object.values(data.months).filter(m => m.totalDuration > 0).length
data.totalActiveDays = Object.values(data.months).filter((m: any) => m.totalDuration > 0).length
return data
} catch (err) {
return createEmptyYearData(year)

View File

@@ -389,7 +389,7 @@ class TimeTrackerService {
const yearData = await this.persistence.getYearData(targetYear)
totalDuration = yearData.yearlyTotal
activeDays = Object.values(yearData.months).reduce((sum, m) => {
return sum + Object.entries(m).filter(([_, d]) => (d as { totalDuration: number }).totalDuration > 0).length
return sum + Object.entries(m).filter(([_, d]) => (d as any).totalDuration > 0).length
}, 0)
for (const [month, summary] of Object.entries(yearData.months)) {