- 整段色块计数改为按当前格所在周期:cycleDone → 1/1,否则 0/1; 不再把全局 used/total 重复到每一格。 - 抽出 blockCellText / blockCellPercent,工作台、大屏、客户自助页共用同一口径; 通行证保持 0/1 / 1/1,深渊按所在周期 1/1 / 0/1。 - 大屏恢复通行证 / 深渊页签;screenCalSubs 补上缺失的 start(之前为零值, 导致大屏周期判定和色阶都算错),大屏格子现在显示与工作台一致的 1/1、0/1 以及 34%→4% 的周期色阶。 - 大屏色块样式:has-block / scr-block,亮暗两套都可读。 - 版本 1.11.5;README 的深渊说明同步,「工作台、大屏、客户自助页同一口径」。 验证:测试数据第一周期完成、第二周期未完成,工作台、 大屏、客户自助页均显示 20–26 为 1/1、27–31 为 0/1;周期浓度 34%/24%/14%/4%;gofmt / go vet / go test 全绿。
This commit is contained in:
@@ -446,15 +446,14 @@ func (s *Server) handleCalendar(w http.ResponseWriter, r *http.Request) {
|
||||
if cs.isBlock() {
|
||||
if cs.blockCovers(ds) && cell.BlockText == "" {
|
||||
cell.BlockColor = cs.sub.PackageColor
|
||||
cell.BlockDone = cs.blockDone()
|
||||
cell.BlockTotal = cs.blockTotal()
|
||||
cell.BlockText = fmt.Sprintf("%d/%d", cell.BlockDone, cell.BlockTotal)
|
||||
cell.BlockTitle = cs.sub.PackageName + " · " + cell.BlockText
|
||||
cell.BlockPercent = 18
|
||||
if cs.sub.Abyss && cs.sub.CycleDays > 0 {
|
||||
idx := domain.CycleIndex(cs.start, day, cs.sub.CycleDays)
|
||||
cell.BlockPercent = abyssBlockPercent(idx, cs.sub.TotalCount)
|
||||
cell.BlockText = blockCellText(cs, ds)
|
||||
cell.BlockDone = 0
|
||||
if cell.BlockText == "1/1" {
|
||||
cell.BlockDone = 1
|
||||
}
|
||||
cell.BlockTotal = 1
|
||||
cell.BlockTitle = cs.sub.PackageName + " · " + cell.BlockText
|
||||
cell.BlockPercent = blockCellPercent(cs, day)
|
||||
}
|
||||
continue
|
||||
}
|
||||
@@ -664,6 +663,30 @@ func assigneeStrip(tickets []Ticket) []string {
|
||||
return out
|
||||
}
|
||||
|
||||
// blockCellText 整段型订阅在 date 所在周期的完成文本:
|
||||
// 通行证 0/1 或 1/1;深渊按 date 所在的那一个周期 0/1 或 1/1,不显示全局 x/N。
|
||||
func blockCellText(cs calSub, date string) string {
|
||||
if cs.sub.Abyss {
|
||||
if cs.cycleDone(date) {
|
||||
return "1/1"
|
||||
}
|
||||
return "0/1"
|
||||
}
|
||||
if cs.sub.SeasonDone != "" {
|
||||
return "1/1"
|
||||
}
|
||||
return "0/1"
|
||||
}
|
||||
|
||||
// blockCellPercent 整段型色块浓度:通行证 18%;深渊按所在周期 34%→4%。
|
||||
func blockCellPercent(cs calSub, day time.Time) int {
|
||||
if cs.sub.Abyss && cs.sub.CycleDays > 0 {
|
||||
idx := domain.CycleIndex(cs.start, day, cs.sub.CycleDays)
|
||||
return abyssBlockPercent(idx, cs.sub.TotalCount)
|
||||
}
|
||||
return 18
|
||||
}
|
||||
|
||||
// abyssBlockPercent 深渊色块浓度:第一个周期 34%,之后每个周期依次减淡,
|
||||
// 最后一个周期 4%(周期数大于 1 时线性过渡);跨度比 v1.11.3 的 22%→10% 明显更大。
|
||||
func abyssBlockPercent(idx, total int) int {
|
||||
|
||||
Reference in New Issue
Block a user