Skip to content

Commit 935fedd

Browse files
author
Ryan Mitchell
committed
修正收益統計日曆無記錄日顯示為零值(3.105.0-rc8)
Made-with: Cursor
1 parent 7c9f351 commit 935fedd

4 files changed

Lines changed: 23 additions & 12 deletions

File tree

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
所有重要的專案更新都會記錄在此檔案中。
44

5+
## [3.105.0-rc8] - 2026-04-21
6+
7+
### Fixed
8+
- **收益統計日曆**:後端未返回某日記錄時(當日無成交等)改為顯示 **+0.00****0.0%** 等零值,不再整月顯示「無數據」;當月日期格均可點擊進入單日詳情。
9+
10+
---
11+
512
## [3.105.0-rc7] - 2026-04-17
613

714
### Changed

main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ import (
4545
)
4646

4747
// Version 应用版本号
48-
var Version = "3.105.0-rc7"
48+
var Version = "3.105.0-rc8"
4949

5050
// capitalDataSourceAdapter 资金數據源适配器
5151
type capitalDataSourceAdapter struct {

webui/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "quantmesh-webui",
3-
"version": "3.105.0-rc7",
3+
"version": "3.105.0-rc8",
44
"type": "module",
55
"packageManager": "yarn@4.12.0",
66
"scripts": {

webui/src/components/StatisticsCalendar.tsx

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,20 @@ const StatisticsCalendar: React.FC<StatisticsCalendarProps> = ({ year, month, da
6464
return `${y}-${m}-${d}`
6565
}
6666

67-
// 獲取某天的统计數據
67+
/** 後端僅在有成交/記錄時返回該日;無記錄視為當日盈虧 0,避免日曆滿屏「無數據」。 */
68+
const emptyDayStats = (dateStr: string): DailyStatistics => ({
69+
date: dateStr,
70+
total_trades: 0,
71+
total_volume: 0,
72+
total_pnl: 0,
73+
win_rate: 0,
74+
})
75+
76+
// 獲取某天的统计數據(當月有效日期必有對象,月初空白格為 null)
6877
const getDayStats = (date: Date | null): DailyStatistics | null => {
6978
if (!date) return null
7079
const dateStr = formatDate(date)
71-
return statsMap.get(dateStr) || null
80+
return statsMap.get(dateStr) ?? emptyDayStats(dateStr)
7281
}
7382

7483
// 今日日期字串(使用本地時區,與日曆格子一致,避免 UTC 導致焦點錯位)
@@ -110,8 +119,7 @@ const StatisticsCalendar: React.FC<StatisticsCalendarProps> = ({ year, month, da
110119
const stats = getDayStats(date)
111120
const isToday = date ? formatDate(date) === todayStr : false
112121
const dateStr = date ? formatDate(date) : ''
113-
const hasData = !!stats
114-
const isClickable = hasData && onDayClick
122+
const isClickable = !!date && !!onDayClick
115123

116124
return (
117125
<div
@@ -159,8 +167,8 @@ const StatisticsCalendar: React.FC<StatisticsCalendarProps> = ({ year, month, da
159167
{date.getDate()}
160168
</div>
161169

162-
{/* 统计數據 */}
163-
{stats ? (
170+
{/* 统计數據(無後端記錄時已補 0,不再顯示「無數據」) */}
171+
{stats && (
164172
<div style={{ flex: 1, fontSize: '11px', lineHeight: '1.4' }}>
165173
<div style={{
166174
color: stats.total_pnl >= 0 ? '#52c41a' : '#ff4d4f',
@@ -223,10 +231,6 @@ const StatisticsCalendar: React.FC<StatisticsCalendarProps> = ({ year, month, da
223231
</div>
224232
)}
225233
</div>
226-
) : (
227-
<div style={{ flex: 1, fontSize: '11px', color: '#bfbfbf' }}>
228-
{t('statistics.noData')}
229-
</div>
230234
)}
231235
</>
232236
) : null}

0 commit comments

Comments
 (0)