Files
diary-system/update_today_progress.py
maoshen 2b35247953 feat: 添加日记草稿生成脚本 + 今日进展更新
- 新增 generate_diary_draft.py - 基于任务进展生成日记草稿
- 新增 update_today_progress.py - 更新任务进展和经验总结
- 完成任务管理功能(100%)
- 完成功能完善任务(100%)
- 添加 3 条经验总结(Tab 设计、任务中心交互、混合记录策略)
2026-04-14 11:06:12 +00:00

86 lines
3.2 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env python3
"""更新今天的任务进展和经验总结"""
import os
import sys
import django
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'diary_system.settings')
sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'backend'))
django.setup()
from diary.models import Task, Experience
from django.utils import timezone
# 更新任务进展
tasks_to_update = [
{
'title': '日记系统 - 工作任务管理功能',
'status': 'completed',
'progress_percent': 100,
'notes': '完成 Task 模型、API、前端展示支持任务追踪和进展记录'
},
{
'title': '日记系统 - 功能完善',
'status': 'completed',
'progress_percent': 100,
'notes': '完成 Tab 切换、日历组件、任务详情视图,交互体验优化'
},
]
print("📝 更新任务进展...\n")
for t_data in tasks_to_update:
task = Task.objects.filter(title=t_data['title']).first()
if task:
old_status = task.status
old_progress = task.progress_percent
task.status = t_data['status']
task.progress_percent = t_data['progress_percent']
if t_data['notes']:
timestamp = timezone.now().strftime('%Y-%m-%d %H:%M')
task.progress_notes = f"[{timestamp}] {t_data['notes']}\n" + task.progress_notes
task.save()
print(f"{task.title}")
print(f" 状态:{old_status}{task.get_status_display()}")
print(f" 进展:{old_progress}% → {task.progress_percent}%")
print()
# 添加经验总结
experiences = [
{
'title': '前端 Tab 切换设计',
'category': 'development',
'problem': '三个板块(任务/日记/经验)占用大量空间,用户需要频繁滚动',
'solution': '使用 Tab 切换共享同一内容区域,减少页面长度,提升导航效率',
'lesson_learned': '空间紧张时考虑用切换代替并列展示。Tab 是简单有效的方案。'
},
{
'title': '以任务为中心的交互设计',
'category': 'development',
'problem': '最初按日期筛选任务,但用户更关心"某个任务的完整历史"而非"某天的所有任务"',
'solution': '改为:列表显示所有任务 → 点击进详情 → 详情中用日历查看该任务的日期进展',
'lesson_learned': '设计前先想清楚用户的核心使用场景。任务追踪 ≠ 日记查看,两者需求不同。'
},
{
'title': '混合式记录策略',
'category': 'other',
'problem': '定时记录 vs 即时记录?各有优劣',
'solution': '三层策略:任务进展(完成后立即)+ 经验总结(解决问题后)+ 日记反思(每天固定时间)',
'lesson_learned': '不要二选一,根据信息类型选择不同频率。实时数据即时记,深度反思定时做。'
},
]
print("💡 添加经验总结...\n")
for exp_data in experiences:
exp, created = Experience.objects.get_or_create(
title=exp_data['title'],
defaults=exp_data
)
if created:
print(f"{exp.title}")
else:
print(f"⏭️ {exp.title} (已存在)")
print("\n🎉 更新完成!")