v1.0.0 — 评分规则大改 & UI优化
- 责善改过:纵向排列、输入框样式对齐立志、扁平化去内层卡片嵌套 - 自动保存:blur 触发替代 input 防抖,静默保存 - 日评分:3项全有 → 60分 + 多出条数×5;缺失 → 条数×5 - 周评分:日峰值累加制,取消百分比上限 - 修复 preset-note 溢出、清理冗余代码
This commit is contained in:
27
app.py
27
app.py
@@ -84,26 +84,23 @@ def compute_stats():
|
||||
evening = data.get('evening', [])
|
||||
study = data.get('study', [])
|
||||
|
||||
total_morning += sum(1 for x in morning if isinstance(x, str) and x.strip())
|
||||
total_evening += sum(1 for x in evening if (
|
||||
morning_count = sum(1 for x in morning if isinstance(x, str) and x.strip())
|
||||
evening_count = sum(1 for x in evening if (
|
||||
isinstance(x, str) and x.strip() or
|
||||
isinstance(x, dict) and (x.get('mistake', '') or '').strip()
|
||||
))
|
||||
total_study += sum(1 for x in study if x.get('done'))
|
||||
study_count = sum(1 for x in study if x.get('done'))
|
||||
|
||||
day_score = 0
|
||||
has_morning = any(isinstance(x, str) and x.strip() for x in morning)
|
||||
has_evening = any(
|
||||
(isinstance(x, str) and x.strip()) or
|
||||
(isinstance(x, dict) and (x.get('mistake', '') or '').strip())
|
||||
for x in evening
|
||||
)
|
||||
has_study = any(x.get('done') for x in study)
|
||||
if has_morning: day_score += 1
|
||||
if has_evening: day_score += 1
|
||||
if has_study: day_score += 1
|
||||
total_morning += morning_count
|
||||
total_evening += evening_count
|
||||
total_study += study_count
|
||||
|
||||
calendar[d] = 'pass' if day_score >= 2 else 'fail'
|
||||
# 新评分:3 项都有 → 达标 60 分 + 额外加分
|
||||
all_three = morning_count > 0 and evening_count > 0 and study_count > 0
|
||||
if all_three:
|
||||
extra = (morning_count - 1) + (evening_count - 1) + (study_count - 1)
|
||||
# day_score = 60 + extra * 5 (不在此处使用,仅用于日历状态)
|
||||
calendar[d] = 'pass' if all_three else 'fail'
|
||||
|
||||
return dict(
|
||||
total_days=total_days, total_morning=total_morning,
|
||||
|
||||
Reference in New Issue
Block a user