fix: 审查修复波次(P0x4 + P1x30+)
- domain/rules: 计分与排名解耦、破纪录按组别、tieBreak 生效、调整分不丢、移除 aggregate 假能力 - realtime: 新建 internal/dto,快照三项契约对齐,/ws 只认会话身份 - httpapi: 流水幂等、standings 整表载荷、广播接线、强制改密、XFF 防伪造、records 写入、审计、赛事包内容、发布前备份、result.points、实例列表 - web: FormData 上传、YAML 解析、快照归一化、大屏解析层、bootstrap 降级、访客判定、主题切换 - console: 优雅关闭握手、中文化、免验证改管理员账号、选屏与日志轮转修复 - docs: 用户文档三份 + README - 主代理: 破纪录加分接线(levels 未加载导致恒 0)
This commit is contained in:
1 parent
8dae63ee70
commit
7f9701c465
61 files changed
+3844
-333
No files matched your search
@@ -193,3 +193,41 @@ func TestRecordBonusLedger(t *testing.T) {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// TestRecordBonusLedgerFiltersByCategory 验证按「小项+组别」过滤:
|
||||
// 上层逐组别调用 ScoreEvent,别的组别的破纪录登记不能在本组别重复记一次加分。
|
||||
func TestRecordBonusLedgerFiltersByCategory(t *testing.T) {
|
||||
entries, results := fixture(lineup(2))
|
||||
entries[1].CategoryID = 2 // entry2 属于另一个组别
|
||||
cfg := bonusConfig(RecordBonusMax)
|
||||
es := mustScore(t, EventScoreInput{
|
||||
Event: individualEvent(1), Category: testCategory(),
|
||||
Channels: []ScoreChannel{athleteResultChannel(1)},
|
||||
Profiles: map[int64]ScoringProfile{1: individualTop6()},
|
||||
Entries: entries, Results: results,
|
||||
RecordBonus: &cfg,
|
||||
RecordBreaks: []RecordBreak{
|
||||
{ID: 1, EventID: 1, EntryID: 1, AthleteID: 101, TeamID: 1001, Level: "meet", State: RecordBreakApproved},
|
||||
{ID: 2, EventID: 1, EntryID: 2, AthleteID: 102, TeamID: 1002, Level: "meet", State: RecordBreakApproved},
|
||||
},
|
||||
})
|
||||
|
||||
var thisCategory, otherCategory int
|
||||
for _, e := range es.Ledger {
|
||||
if e.SourceType != SourceRecordBonus {
|
||||
continue
|
||||
}
|
||||
switch e.EntryID {
|
||||
case 1:
|
||||
thisCategory++
|
||||
case 2:
|
||||
otherCategory++
|
||||
}
|
||||
}
|
||||
if thisCategory != 1 {
|
||||
t.Fatalf("本组别加分流水 = %d 条,期望 1", thisCategory)
|
||||
}
|
||||
if otherCategory != 0 {
|
||||
t.Fatalf("别的组别的加分不应记入本组别,实际 %d 条", otherCategory)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user