feat: add completed task and project summary

- Add completed timeblock queries and completed project aggregation\n- Add desktop completed summary dialog with range filters, stats, and streak\n- Add medal entry point in the today panel\n- Add Android completed summary menu with local statistics\n- Rebuild AppImage and update validation docs/screenshots
This commit is contained in:
Misaki
2026-11-10 16:45:54 +08:00
parent 35cabb37b2
commit bfab0579a7
33 changed files with 860 additions and 17 deletions
+10 -1
View File
@@ -2,7 +2,7 @@
细粒度个人日程 + AI 自然语言排程 + 自部署多设备同步。
当前进度:**阶段 0–4 + 搜索 / 重复日程 / 长期项目 / Windows 安装包 / Linux AppImage / 界面动画 + 桌面日程提醒 + Android 同步客户端 v1**。
当前进度:**阶段 0–4 + 搜索 / 重复日程 / 长期项目 / 完成汇总 / Windows 安装包 / Linux AppImage / 界面动画 + 桌面日程提醒 + Android 同步客户端 v1**。
本地模型 50 条指令回归已完成:完整 49/50(98%),失败项 #42 单独复测通过。
详细计划见 [`docs/PLAN.md`](docs/PLAN.md),验证记录见 [`docs/validation/`](docs/validation/)。
@@ -93,6 +93,15 @@
- 长期项目通过同步变更流同步到其他桌面端;Android 当前只展示,不提供创建/编辑。
- 项目截止日期是日期级模糊值,不参与精力曲线、幽灵时间或自动排程。
## 已完成汇总
今日任务面板标题旁的奖牌按钮打开「已完成汇总」:
- 可选择本周 / 本月 / 全部范围。
- 统计已完成短期任务数、累计专注时长、已完成长期项目数、连续完成天数。
- 分别列出已完成的短期任务和长期项目,带完成时间和截止日期。
- Android 菜单也提供「已完成汇总」,展示同类统计和最近完成记录。
## 同步冲突行为
同步是后台无感进行的:不弹冲突对话框,失败自动重试,状态只显示在顶部标签。
+1
View File
@@ -8,6 +8,7 @@
- 本地 SQLite:task / timeblock / outbox / sync_state。
- 同步:设备注册、outbox 推送、增量拉取、LWW、WebSocket 通知、定时轮询。
- 长期项目:接收桌面端项目,在今日列表上方只读展示标题和截止倒计时。
- 已完成汇总:右上角菜单查看短期任务数、专注时长、长期项目数和最近完成记录。
- 提醒:日程开始、提前 N 分钟、结束后未完成都会发本地通知;通知点击回到对应日期。
- 后台:WorkManager 每 15 分钟同步一次;开机接收 `BOOT_COMPLETED` 重新登记任务。
- 设置:同步服务地址与启用开关;不支持 AI 对话和附件提取(桌面端功能)。
@@ -6,6 +6,7 @@ import android.content.pm.PackageManager
import android.os.Build
import android.os.Bundle
import android.view.View
import android.widget.ScrollView
import android.widget.TextView
import androidx.activity.result.contract.ActivityResultContracts
import androidx.appcompat.app.AppCompatActivity
@@ -114,6 +115,10 @@ class MainActivity : AppCompatActivity() {
val toolbar = findViewById<MaterialToolbar>(R.id.toolbar)
toolbar.setOnMenuItemClickListener { item ->
when (item.itemId) {
R.id.action_completed -> {
showCompletedSummary()
true
}
R.id.action_sync -> {
syncManager.reload()
true
@@ -172,6 +177,47 @@ class MainActivity : AppCompatActivity() {
super.onDestroy()
}
private fun showCompletedSummary() {
val items = repository.completedItems()
val projects = repository.completedProjects()
val focusedMinutes = items.sumOf {
val start = TimeUtils.parse(it.block.startAt)
val end = TimeUtils.parse(it.block.endAt)
if (start != null && end != null) {
maxOf(0, java.time.Duration.between(start, end).toMinutes().toInt())
} else 0
}
val summaryText = buildString {
append("短期任务 ${items.size} · 长期项目 ${projects.size}\n")
append("累计专注 ${focusedMinutes / 60} 小时 ${focusedMinutes % 60} 分钟\n\n")
if (items.isNotEmpty()) {
append("短期任务\n")
items.take(50).forEach {
append("· ${it.task.title} ${TimeUtils.formatDate(it.block.doneAt ?: it.block.endAt)}\n")
}
append("\n")
}
if (projects.isNotEmpty()) {
append("长期项目\n")
projects.forEach { append("· ${it.title} ${TimeUtils.formatDate(it.updatedAt)}\n") }
}
if (items.isEmpty() && projects.isEmpty()) {
append("还没有已完成记录。")
}
}
val content = TextView(this).apply {
text = summaryText
textSize = 14f
setPadding(48, 24, 48, 24)
}
val scroll = ScrollView(this).apply { addView(content) }
MaterialAlertDialogBuilder(this)
.setTitle(R.string.completed_summary)
.setView(scroll)
.setPositiveButton(android.R.string.ok, null)
.show()
}
private fun refresh() {
dateText.text = selectedDate.format(dateFormatter)
val items = repository.itemsForDate(selectedDate)
@@ -80,6 +80,58 @@ class ScheduleRepository(context: Context) {
return result
}
fun completedItems(): List<ScheduleItem> {
val result = mutableListOf<ScheduleItem>()
db.rawQuery(
"""
SELECT t.id, t.title, t.description, t.source, t.source_ref, t.estimated_min,
t.energy_req, t.deadline, t.priority, t.status, t.created_at, t.updated_at,
t.version, t.device_id,
b.id, b.task_id, b.start_at, b.end_at, b.granularity, b.splittable,
b.breakable, b.status, b.done_at, b.created_at, b.updated_at, b.version, b.device_id
FROM timeblock b JOIN task t ON t.id = b.task_id
WHERE b.status = 'done'
ORDER BY COALESCE(b.done_at, b.end_at) DESC
LIMIT 200
""".trimIndent(),
emptyArray()
).use { cursor ->
while (cursor.moveToNext()) result.add(readItem(cursor))
}
return result
}
fun completedProjects(): List<Project> {
val result = mutableListOf<Project>()
db.rawQuery(
"""
SELECT id, title, description, source, source_ref, deadline, priority, status,
created_at, updated_at, version, device_id
FROM project WHERE status = 'done'
ORDER BY updated_at DESC
""".trimIndent(),
emptyArray()
).use { cursor ->
while (cursor.moveToNext()) {
result.add(Project(
id = cursor.getString(0),
title = cursor.getString(1),
description = cursor.stringOrNull(2),
source = cursor.getString(3) ?: "android",
sourceRef = cursor.stringOrNull(4),
deadline = cursor.stringOrNull(5),
priority = cursor.getInt(6),
status = cursor.getString(7) ?: "done",
createdAt = cursor.getString(8),
updatedAt = cursor.getString(9),
version = cursor.getInt(10),
deviceId = cursor.getString(11),
))
}
}
return result
}
fun create(title: String, start: LocalDateTime, end: LocalDateTime, deviceId: String): String {
val now = TimeUtils.nowIso()
val taskId = UUID.randomUUID().toString()
@@ -1,5 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/action_completed"
android:title="@string/completed_summary"
android:showAsAction="never" />
<item
android:id="@+id/action_sync"
android:title="@string/sync_now"
@@ -7,6 +7,7 @@
<string name="next_day">后一天</string>
<string name="add_schedule">新建日程</string>
<string name="long_term_projects">长期项目</string>
<string name="completed_summary">已完成汇总</string>
<string name="empty_schedule">今天还没有安排</string>
<string name="sync_local">本地</string>
<string name="sync_not_configured">未配置同步服务</string>
+2
View File
@@ -83,6 +83,8 @@ add_library(schedule_ui STATIC
ui/MainWindow.h
ui/dialogs/BlockEditDialog.cpp
ui/dialogs/BlockEditDialog.h
ui/dialogs/CompletedSummaryDialog.cpp
ui/dialogs/CompletedSummaryDialog.h
ui/dialogs/DailyReviewDialog.cpp
ui/dialogs/DailyReviewDialog.h
ui/dialogs/ProjectDialog.cpp
+35
View File
@@ -1422,6 +1422,41 @@ QVector<ScheduleItem> ScheduleService::search(const QString& query, int limit) c
return m_store.search(query, limit);
}
QVector<ScheduleItem> ScheduleService::completedItems(const QDate& from, const QDate& to) const
{
if (!from.isValid() || !to.isValid() || from > to)
{
return {};
}
return m_store.completedBlocks(DateTimeUtils::localDayStartUtc(from),
DateTimeUtils::localDayEndUtc(to));
}
QVector<Project> ScheduleService::completedProjects(const QDate& from, const QDate& to) const
{
if (!from.isValid() || !to.isValid() || from > to)
{
return {};
}
QVector<Project> result;
for (const Project& project : m_store.projects(true))
{
if (project.status != QStringLiteral("done"))
{
continue;
}
const QDate completed = project.updatedAt.date();
if (completed >= from && completed <= to)
{
result.append(project);
}
}
std::sort(result.begin(), result.end(), [](const Project& a, const Project& b) {
return a.updatedAt > b.updatedAt;
});
return result;
}
QString ScheduleService::lastError() const
{
return m_lastError;
+2
View File
@@ -77,6 +77,8 @@ public:
QVector<ScheduleItem> itemsForRange(const QDate& from, const QDate& to) const;
QVector<ScheduleItem> overdueItems(const QDateTime& now = QDateTime::currentDateTime()) const;
QVector<ScheduleItem> search(const QString& query, int limit = 100) const;
QVector<ScheduleItem> completedItems(const QDate& from, const QDate& to) const;
QVector<Project> completedProjects(const QDate& from, const QDate& to) const;
QString lastError() const;
const EnergyProfile& energyProfile() const;
+35
View File
@@ -1332,6 +1332,41 @@ std::optional<Recurrence> SqliteStore::recurrenceForTask(const QString& taskId)
return recurrence;
}
QVector<ScheduleItem> SqliteStore::completedBlocks(const QDateTime& fromUtc,
const QDateTime& toUtc) const
{
m_lastError.clear();
QVector<ScheduleItem> items;
if (!isOpenInternal())
{
setError(QStringLiteral("数据库未打开"));
return items;
}
QSqlQuery query(m_database);
query.prepare(QStringLiteral(
"SELECT %1, %2 FROM timeblock b JOIN task t ON t.id = b.task_id "
"WHERE b.status = 'done' "
"AND COALESCE(b.done_at, b.end_at) >= :from "
"AND COALESCE(b.done_at, b.end_at) < :to "
"ORDER BY COALESCE(b.done_at, b.end_at) DESC")
.arg(QString::fromLatin1(kBlockColumns), QString::fromLatin1(kTaskColumns)));
query.bindValue(QStringLiteral(":from"), DateTimeUtils::toDb(fromUtc));
query.bindValue(QStringLiteral(":to"), DateTimeUtils::toDb(toUtc));
if (!query.exec())
{
setError(QStringLiteral("查询已完成日程失败: %1").arg(query.lastError().text()));
return items;
}
while (query.next())
{
ScheduleItem item;
item.block = mapTimeBlock(query, 0);
item.task = mapTask(query, 13);
items.append(item);
}
return items;
}
QVector<ScheduleItem> SqliteStore::search(const QString& query, int limit) const
{
m_lastError.clear();
+1
View File
@@ -67,6 +67,7 @@ public:
// 已结束但仍未完成、且结束时间在最近 windowDays 内的块。
QVector<ScheduleItem> overdueBefore(const QDateTime& nowUtc, int windowDays = 30) const;
QVector<ScheduleItem> search(const QString& query, int limit = 100) const;
QVector<ScheduleItem> completedBlocks(const QDateTime& fromUtc, const QDateTime& toUtc) const;
QVector<SyncOutboxItem> outboxBatch(int limit, QString* error = nullptr) const;
int outboxCount(QString* error = nullptr) const;
+9
View File
@@ -29,6 +29,7 @@
#include "sync/SyncService.h"
#include "ui/MainWindow.h"
#include "ui/dialogs/BlockEditDialog.h"
#include "ui/dialogs/CompletedSummaryDialog.h"
#include "ui/dialogs/DailyReviewDialog.h"
#include "ui/dialogs/ProjectDialog.h"
#include "ui/dialogs/SettingsDialog.h"
@@ -267,6 +268,7 @@ void CompactWindow::connectSignals()
}
});
connect(m_todayPanel, &TodayPanel::reviewRequested, this, &CompactWindow::openDailyReview);
connect(m_todayPanel, &TodayPanel::achievementsRequested, this, &CompactWindow::openCompletedSummary);
connect(m_todayPanel, &TodayPanel::newProjectRequested, this, &CompactWindow::openNewProject);
connect(m_todayPanel, &TodayPanel::editProjectRequested, this, &CompactWindow::openEditProject);
connect(m_todayPanel, &TodayPanel::projectStatusRequested, this, [this](const QString& id, const QString& status) {
@@ -438,6 +440,13 @@ void CompactWindow::openDailyReview()
dialog.exec();
}
void CompactWindow::openCompletedSummary()
{
CompletedSummaryDialog dialog(m_scheduleService, m_tokens, this);
dialog.moveToCenter();
dialog.exec();
}
void CompactWindow::openNewProject()
{
ProjectDialog dialog(m_tokens, this);
+1
View File
@@ -65,6 +65,7 @@ private:
void openSchedule();
void openSettings();
void openDailyReview();
void openCompletedSummary();
void openNewProject();
void openEditProject(const QString& projectId);
void openEditDialog(const QString& blockId);
+9
View File
@@ -34,6 +34,7 @@
#include "services/ScheduleService.h"
#include "sync/SyncService.h"
#include "ui/dialogs/BlockEditDialog.h"
#include "ui/dialogs/CompletedSummaryDialog.h"
#include "ui/dialogs/DailyReviewDialog.h"
#include "ui/dialogs/ProjectDialog.h"
#include "ui/dialogs/SearchDialog.h"
@@ -424,6 +425,7 @@ void MainWindow::connectSignals()
m_grid->setFocus(Qt::OtherFocusReason);
});
connect(m_todayPanel, &TodayPanel::reviewRequested, this, &MainWindow::openDailyReview);
connect(m_todayPanel, &TodayPanel::achievementsRequested, this, &MainWindow::openCompletedSummary);
connect(m_todayPanel, &TodayPanel::newProjectRequested, this, &MainWindow::openNewProject);
connect(m_todayPanel, &TodayPanel::editProjectRequested, this, &MainWindow::openEditProject);
connect(m_todayPanel, &TodayPanel::projectStatusRequested, this, [this](const QString& id, const QString& status) {
@@ -900,6 +902,13 @@ void MainWindow::openDailyReview()
dialog.exec();
}
void MainWindow::openCompletedSummary()
{
CompletedSummaryDialog dialog(m_scheduleService, m_tokens, this);
dialog.moveToCenter();
dialog.exec();
}
void MainWindow::openNewProject()
{
ProjectDialog dialog(m_tokens, this);
+1
View File
@@ -91,6 +91,7 @@ private:
void openEditDialog(const QString& blockId);
void openSettings();
void openDailyReview();
void openCompletedSummary();
void openNewProject();
void openEditProject(const QString& projectId);
void updateOverdueBanner(const QVector<ScheduleItem>& items);
@@ -0,0 +1,288 @@
#include "CompletedSummaryDialog.h"
#include <QDate>
#include <QFrame>
#include <QLayoutItem>
#include <QSet>
#include <QTimer>
#include <QHBoxLayout>
#include <QLabel>
#include <QVBoxLayout>
#include "ElaComboBox.h"
#include "ElaPushButton.h"
#include "ElaScrollArea.h"
#include "ElaText.h"
#include "core/DateTimeUtils.h"
#include "services/ScheduleService.h"
#include "storage/SqliteStore.h"
#include "ui/theme/AnimationUtils.h"
namespace
{
QString formatMinutes(int minutes)
{
if (minutes <= 0)
{
return QStringLiteral("0 分钟");
}
return DateTimeUtils::formatDuration(minutes);
}
} // namespace
CompletedSummaryDialog::CompletedSummaryDialog(ScheduleService& scheduleService,
const ThemeTokens& tokens,
QWidget* parent)
: ElaDialog(parent)
, m_scheduleService(scheduleService)
, m_tokens(tokens)
{
setWindowTitle(QStringLiteral("已完成汇总"));
setWindowButtonFlags(ElaAppBarType::CloseButtonHint);
resize(640, 680);
setMinimumWidth(560);
auto* root = new QVBoxLayout(this);
root->setContentsMargins(24, 8, 24, 18);
root->setSpacing(10);
auto* title = new ElaText(QStringLiteral("已完成汇总"), 18, this);
QFont titleFont = title->font();
titleFont.setWeight(QFont::DemiBold);
title->setFont(titleFont);
root->addWidget(title);
auto* subtitle = new ElaText(QStringLiteral("把完成的事情放在一起,看看你已经走了多远。"), 11, this);
subtitle->setTextStyle(ElaTextType::Caption);
root->addWidget(subtitle);
auto* rangeRow = new QHBoxLayout();
rangeRow->setSpacing(10);
auto* rangeLabel = new ElaText(QStringLiteral("范围"), 12, this);
m_rangeCombo = new ElaComboBox(this);
m_rangeCombo->addItems({QStringLiteral("本周"),
QStringLiteral("本月"),
QStringLiteral("全部")});
m_rangeCombo->setCurrentIndex(2);
m_rangeCombo->setFixedSize(130, 32);
rangeRow->addWidget(rangeLabel, 0, Qt::AlignVCenter);
rangeRow->addWidget(m_rangeCombo, 0, Qt::AlignVCenter);
rangeRow->addStretch(1);
root->addLayout(rangeRow);
auto* stats = new QHBoxLayout();
stats->setSpacing(28);
const auto addStat = [this, stats](const QString& label, ElaText** valueOut) {
auto* column = new QVBoxLayout();
column->setSpacing(2);
auto* title = new ElaText(label, 11, this);
title->setTextStyle(ElaTextType::Caption);
auto* value = new ElaText(QStringLiteral("0"), 19, this);
QFont font = value->font();
font.setWeight(QFont::DemiBold);
value->setFont(font);
column->addWidget(title);
column->addWidget(value);
stats->addLayout(column);
*valueOut = value;
};
addStat(QStringLiteral("短期任务"), &m_taskStat);
addStat(QStringLiteral("专注时长"), &m_focusStat);
addStat(QStringLiteral("长期项目"), &m_projectStat);
addStat(QStringLiteral("连续完成"), &m_streakStat);
root->addLayout(stats);
auto* divider = new QFrame(this);
divider->setFrameShape(QFrame::HLine);
divider->setFrameShadow(QFrame::Plain);
root->addWidget(divider);
m_scrollArea = new ElaScrollArea(this);
m_scrollArea->setWidgetResizable(true);
m_scrollArea->setFrameShape(QFrame::NoFrame);
m_scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
m_scrollArea->setStyleSheet(QStringLiteral("QScrollArea{background:transparent;border:none;}"));
m_scrollArea->viewport()->setAutoFillBackground(false);
m_scrollArea->viewport()->setStyleSheet(QStringLiteral("background:transparent;"));
m_listWidget = new QWidget(m_scrollArea);
m_listWidget->setAutoFillBackground(false);
m_listWidget->setStyleSheet(QStringLiteral("background:transparent;"));
m_listLayout = new QVBoxLayout(m_listWidget);
m_listLayout->setContentsMargins(0, 0, 4, 0);
m_listLayout->setSpacing(6);
m_listLayout->addStretch(1);
m_scrollArea->setWidget(m_listWidget);
root->addWidget(m_scrollArea, 1);
auto* closeRow = new QHBoxLayout();
closeRow->addStretch(1);
auto* close = new ElaPushButton(QStringLiteral("完成"), this);
close->setFixedSize(88, 34);
close->setDefault(true);
closeRow->addWidget(close);
root->addLayout(closeRow);
connect(close, &ElaPushButton::clicked, this, &CompletedSummaryDialog::accept);
connect(m_rangeCombo, &ElaComboBox::currentIndexChanged, this, [this](int) { rebuild(); });
rebuild();
QTimer::singleShot(0, this, [this]() { AnimationUtils::fadeWindow(this); });
}
void CompletedSummaryDialog::clearLayout(QVBoxLayout* layout)
{
while (QLayoutItem* item = layout->takeAt(0))
{
if (QWidget* widget = item->widget())
{
widget->hide();
widget->deleteLater();
}
delete item;
}
}
QString CompletedSummaryDialog::shortRangeStart() const
{
const QDate today = QDate::currentDate();
switch (m_rangeCombo->currentIndex())
{
case 0:
return today.addDays(1 - today.dayOfWeek()).toString(Qt::ISODate);
case 1:
return QDate(today.year(), today.month(), 1).toString(Qt::ISODate);
default:
return QDate(2000, 1, 1).toString(Qt::ISODate);
}
}
void CompletedSummaryDialog::rebuild()
{
if (!m_listLayout)
{
return;
}
clearLayout(m_listLayout);
const QDate today = QDate::currentDate();
const QDate start = QDate::fromString(shortRangeStart(), Qt::ISODate);
const auto items = m_scheduleService.completedItems(start, today);
const auto projects = m_scheduleService.completedProjects(start, today);
int focusedMinutes = 0;
QSet<QDate> completionDays;
for (const ScheduleItem& item : items)
{
focusedMinutes += qMax(0, DateTimeUtils::minutesBetween(item.block.startAt, item.block.endAt));
completionDays.insert(item.block.doneAt.has_value() ? item.block.doneAt->date()
: item.block.endAt.date());
}
for (const Project& project : projects)
{
completionDays.insert(project.updatedAt.date());
}
int streak = 0;
QDate cursor = completionDays.contains(today) ? today : today.addDays(-1);
while (completionDays.contains(cursor))
{
++streak;
cursor = cursor.addDays(-1);
}
m_taskStat->setText(QString::number(items.size()));
m_focusStat->setText(formatMinutes(focusedMinutes));
m_projectStat->setText(QString::number(projects.size()));
m_streakStat->setText(QStringLiteral("%1 天").arg(streak));
const auto addSection = [this](const QString& text) {
auto* label = new ElaText(text, 13, m_listWidget);
QFont font = label->font();
font.setWeight(QFont::DemiBold);
label->setFont(font);
label->setContentsMargins(2, 8, 0, 2);
m_listLayout->addWidget(label);
};
const auto addEmpty = [this](const QString& text) {
auto* label = new ElaText(text, 12, m_listWidget);
label->setTextStyle(ElaTextType::Caption);
label->setContentsMargins(2, 2, 0, 2);
m_listLayout->addWidget(label);
};
if (items.isEmpty() && projects.isEmpty())
{
addEmpty(QStringLiteral("这个范围内还没有已完成记录。"));
m_listLayout->addStretch(1);
return;
}
addSection(QStringLiteral("短期任务 · %1").arg(items.size()));
if (items.isEmpty())
{
addEmpty(QStringLiteral("暂无已完成短期任务。"));
}
int shown = 0;
for (const ScheduleItem& item : items)
{
if (shown++ >= 80)
{
break;
}
auto* card = new QFrame(m_listWidget);
card->setStyleSheet(
QStringLiteral("QFrame{background:%1;border:1px solid %2;border-radius:8px;}")
.arg(m_tokens.cardBackground.name(), m_tokens.cardBorder.name()));
auto* layout = new QVBoxLayout(card);
layout->setContentsMargins(10, 7, 10, 7);
layout->setSpacing(2);
auto* name = new QLabel(item.task.title, card);
name->setStyleSheet(QStringLiteral("background:transparent;border:none;color:%1;font-size:12px;font-weight:600;")
.arg(m_tokens.textPrimary.name()));
const QDateTime doneAt = item.block.doneAt.value_or(item.block.endAt);
auto* detail = new QLabel(
QStringLiteral("完成于 %1 · %2–%3")
.arg(doneAt.toString(QStringLiteral("MM-dd HH:mm")),
item.block.startAt.toString(QStringLiteral("HH:mm")),
item.block.endAt.toString(QStringLiteral("HH:mm"))),
card);
detail->setStyleSheet(QStringLiteral("background:transparent;border:none;color:%1;font-size:11px;")
.arg(m_tokens.textMuted.name()));
layout->addWidget(name);
layout->addWidget(detail);
m_listLayout->addWidget(card);
}
addSection(QStringLiteral("长期项目 · %1").arg(projects.size()));
if (projects.isEmpty())
{
addEmpty(QStringLiteral("暂无已完成长期项目。"));
}
for (const Project& project : projects)
{
auto* card = new QFrame(m_listWidget);
card->setStyleSheet(
QStringLiteral("QFrame{background:%1;border:1px solid %2;border-left:3px solid %3;border-radius:8px;}")
.arg(m_tokens.cardBackground.name(),
m_tokens.cardBorder.name(),
m_tokens.success.name()));
auto* layout = new QVBoxLayout(card);
layout->setContentsMargins(10, 7, 10, 7);
layout->setSpacing(2);
auto* name = new QLabel(project.title, card);
name->setStyleSheet(QStringLiteral("background:transparent;border:none;color:%1;font-size:12px;font-weight:600;")
.arg(m_tokens.textPrimary.name()));
auto* detail = new QLabel(
QStringLiteral("完成于 %1%2")
.arg(project.updatedAt.toString(QStringLiteral("MM-dd HH:mm")),
project.deadline.has_value()
? QStringLiteral(" · 截止 %1").arg(project.deadline->toString(QStringLiteral("yyyy-MM-dd")))
: QString()),
card);
detail->setStyleSheet(QStringLiteral("background:transparent;border:none;color:%1;font-size:11px;")
.arg(m_tokens.textMuted.name()));
layout->addWidget(name);
layout->addWidget(detail);
m_listLayout->addWidget(card);
}
m_listLayout->addStretch(1);
AnimationUtils::fadeIn(m_listWidget, 150);
}
@@ -0,0 +1,41 @@
#pragma once
#include "ElaDialog.h"
#include "ui/theme/ThemeTokens.h"
class ElaComboBox;
class ElaScrollArea;
class ElaText;
class QVBoxLayout;
class ScheduleService;
/*
* 类名: CompletedSummaryDialog
* 功能: 汇总已完成的短期任务与长期项目,展示统计、连续天数和完成记录
* 线程安全: 否;UI 线程
*/
class CompletedSummaryDialog : public ElaDialog
{
Q_OBJECT
public:
CompletedSummaryDialog(ScheduleService& scheduleService,
const ThemeTokens& tokens,
QWidget* parent = nullptr);
private:
void rebuild();
static void clearLayout(QVBoxLayout* layout);
QString shortRangeStart() const;
ScheduleService& m_scheduleService;
ThemeTokens m_tokens;
ElaComboBox* m_rangeCombo = nullptr;
ElaText* m_taskStat = nullptr;
ElaText* m_focusStat = nullptr;
ElaText* m_projectStat = nullptr;
ElaText* m_streakStat = nullptr;
ElaScrollArea* m_scrollArea = nullptr;
QWidget* m_listWidget = nullptr;
QVBoxLayout* m_listLayout = nullptr;
};
+8
View File
@@ -41,6 +41,13 @@ TodayPanel::TodayPanel(QWidget* parent)
m_reviewButton->setToolTip(QStringLiteral("今日复盘 (Ctrl+R)"));
connect(m_reviewButton, &ElaToolButton::clicked, this, &TodayPanel::reviewRequested);
m_achievementsButton = new ElaToolButton(this);
m_achievementsButton->setIsTransparent(true);
m_achievementsButton->setElaIcon(ElaIconType::Medal);
m_achievementsButton->setFixedSize(26, 26);
m_achievementsButton->setToolTip(QStringLiteral("已完成汇总"));
connect(m_achievementsButton, &ElaToolButton::clicked, this, &TodayPanel::achievementsRequested);
m_newProjectButton = new ElaToolButton(this);
m_newProjectButton->setIsTransparent(true);
m_newProjectButton->setElaIcon(ElaIconType::FolderPlus);
@@ -51,6 +58,7 @@ TodayPanel::TodayPanel(QWidget* parent)
header->addWidget(m_titleLabel);
header->addStretch(1);
header->addWidget(m_countLabel, 0, Qt::AlignVCenter);
header->addWidget(m_achievementsButton, 0, Qt::AlignVCenter);
header->addWidget(m_newProjectButton, 0, Qt::AlignVCenter);
header->addWidget(m_reviewButton, 0, Qt::AlignVCenter);
root->addLayout(header);
+2
View File
@@ -38,6 +38,7 @@ signals:
void deleteRequested(const QString& blockId);
void focusRequested(const QString& blockId);
void reviewRequested();
void achievementsRequested();
void newProjectRequested();
void editProjectRequested(const QString& projectId);
void projectStatusRequested(const QString& projectId, const QString& status);
@@ -57,6 +58,7 @@ private:
ElaText* m_insightLabel = nullptr;
ElaToolButton* m_reviewButton = nullptr;
ElaToolButton* m_newProjectButton = nullptr;
ElaToolButton* m_achievementsButton = nullptr;
ElaScrollArea* m_scrollArea = nullptr;
QWidget* m_listWidget = nullptr;
QVBoxLayout* m_listLayout = nullptr;
+36
View File
@@ -19,6 +19,7 @@
#include "ui/CompactWindow.h"
#include "ui/MainWindow.h"
#include "ui/dialogs/BlockEditDialog.h"
#include "ui/dialogs/CompletedSummaryDialog.h"
#include "ui/dialogs/DailyReviewDialog.h"
#include "ui/dialogs/ProjectDialog.h"
#include "ui/dialogs/SearchDialog.h"
@@ -70,6 +71,7 @@ private slots:
void searchDialogFindsSchedules();
void repeatDialogShowsOptions();
void projectDialogShowsFields();
void completedSummaryShowsStats();
void aiChatShowsDiffAndAccepts();
void aiChatShowsMultiOperationDiff();
@@ -131,6 +133,19 @@ void TestCompactWindow::createSampleData(ScheduleService& service, const QDate&
today.addDays(30),
&projectError),
qPrintable(projectError));
QVERIFY2(service.createProject(QStringLiteral("已完成旧项目"),
QStringLiteral("历史项目"),
today.addDays(-10),
&projectError),
qPrintable(projectError));
for (const Project& project : service.projects())
{
if (project.title == QStringLiteral("已完成旧项目"))
{
service.setProjectStatus(project.id, QStringLiteral("done"), &projectError);
break;
}
}
QVERIFY(create(QStringLiteral("团队同步"),
QDateTime(today, QTime(10, 0), Qt::LocalTime),
QDateTime(today, QTime(11, 0), Qt::LocalTime)));
@@ -405,6 +420,27 @@ void TestCompactWindow::projectDialogShowsFields()
dialog.accept();
}
void TestCompactWindow::completedSummaryShowsStats()
{
QTemporaryDir databaseDir;
QVERIFY(databaseDir.isValid());
SqliteStore store(databaseDir.filePath(QStringLiteral("schedule.db")));
QString error;
QVERIFY2(store.open(&error), qPrintable(error));
ThemeManager theme(*m_settings);
theme.initialize();
ScheduleService service(store, QStringLiteral("summary-test"));
createSampleData(service, QDate::currentDate());
CompletedSummaryDialog dialog(service, theme.tokens());
dialog.show();
QVERIFY(QTest::qWaitForWindowExposed(&dialog));
QTest::qWait(300);
saveWindow(&dialog, QStringLiteral("completed-summary.png"));
dialog.close();
}
void TestCompactWindow::aiChatShowsDiffAndAccepts()
{
QTemporaryDir databaseDir;
+32
View File
@@ -30,6 +30,7 @@ private slots:
void createsRecurringSchedules();
void startAndLeadReminders();
void projectCrudAndPersistence();
void completedSummaryQueries();
};
namespace
@@ -515,5 +516,36 @@ void TestServices::projectCrudAndPersistence()
QVERIFY(!context.service->projectById(id).has_value());
}
void TestServices::completedSummaryQueries()
{
Context context;
QVERIFY(context.open());
const QDate today = QDate::currentDate();
const QDateTime start(today, QTime(9, 0), Qt::LocalTime);
QString error;
QVERIFY(context.service->createBlock(QStringLiteral("已完成短期任务"),
start,
start.addSecs(90 * 60),
&error));
const QString blockId = context.service->itemsForDay(today).first().block.id;
QVERIFY2(context.service->setBlockStatus(blockId, QStringLiteral("done"), &error), qPrintable(error));
QVERIFY(context.service->createProject(QStringLiteral("已完成长期项目"),
QStringLiteral("项目说明"),
today.addDays(10),
&error));
const QString projectId = context.service->projects().first().id;
QVERIFY2(context.service->setProjectStatus(projectId, QStringLiteral("done"), &error), qPrintable(error));
const QVector<ScheduleItem> completed = context.service->completedItems(today, today);
QCOMPARE(completed.size(), 1);
QCOMPARE(completed.first().task.title, QStringLiteral("已完成短期任务"));
const QVector<Project> projects = context.service->completedProjects(today, today);
QCOMPARE(projects.size(), 1);
QCOMPARE(projects.first().title, QStringLiteral("已完成长期项目"));
QCOMPARE(context.service->completedItems(today.addDays(1), today.addDays(2)).size(), 0);
}
QTEST_GUILESS_MAIN(TestServices)
#include "test_services.moc"
+9
View File
@@ -13,6 +13,7 @@
> 阶段 4.2(桌面开始提醒 / 原生通知 / 点击定位)已验证:[`validation/phase-4-2.md`](validation/phase-4-2.md)。
> 阶段 4.3(Linux AppImage)已验证:[`validation/phase-4-3.md`](validation/phase-4-3.md)。
> 阶段 4.4(长期项目 / AI 识别 / 跨端展示)已验证:[`validation/phase-4-4.md`](validation/phase-4-4.md)。
> 阶段 4.5(已完成任务/项目汇总)已验证:[`validation/phase-4-5.md`](validation/phase-4-5.md)。
> 阶段 5.0(Android 同步客户端)已构建验证:[`validation/phase-5.md`](validation/phase-5.md)。
> 阶段 5.1(移动提醒 / 完成同步修复 / MinGW 修复)已验证:[`validation/phase-5-1.md`](validation/phase-5-1.md)。
@@ -171,6 +172,14 @@ Schedule/
- [x] Android 接收/只读展示长期项目
- 验收:`ctest 12/12`;Android 8/8;见 [`validation/phase-4-4.md`](validation/phase-4-4.md)
### 阶段 4.5:已完成汇总(已完成)
- [x] 已完成短期任务查询与完成时间排序
- [x] 已完成长期项目查询
- [x] 本周/本月/全部范围、完成数/专注时长/项目数/连续天数
- [x] 桌面汇总对话框与今日面板奖牌入口
- [x] Android 菜单「已完成汇总」统计与最近记录
- 验收:`ctest 12/12`;Android 8/8;见 [`validation/phase-4-5.md`](validation/phase-4-5.md)
### 阶段 5.0:Android 同步客户端(已完成 v1)
- [x] 独立 Kotlin/Android 工程,不依赖 Qt
- [x] SQLite task/timeblock/outbox/sync_state、LWW、删除墓碑
@@ -0,0 +1,60 @@
To honour the JVM settings for this build a single-use Daemon process will be forked. For more on this, please refer to https://docs.gradle.org/8.7/userguide/gradle_daemon.html#sec:disabling_the_daemon in the Gradle documentation.
Daemon will be stopped at the end of the build
> Task :app:preBuild UP-TO-DATE
> Task :app:preDebugBuild UP-TO-DATE
> Task :app:mergeDebugNativeDebugMetadata NO-SOURCE
> Task :app:checkKotlinGradlePluginConfigurationErrors
> Task :app:checkDebugAarMetadata UP-TO-DATE
> Task :app:generateDebugResValues UP-TO-DATE
> Task :app:mapDebugSourceSetPaths UP-TO-DATE
> Task :app:generateDebugResources UP-TO-DATE
> Task :app:mergeDebugResources UP-TO-DATE
> Task :app:packageDebugResources UP-TO-DATE
> Task :app:parseDebugLocalResources UP-TO-DATE
> Task :app:createDebugCompatibleScreenManifests UP-TO-DATE
> Task :app:extractDeepLinksDebug UP-TO-DATE
> Task :app:processDebugMainManifest UP-TO-DATE
> Task :app:processDebugManifest UP-TO-DATE
> Task :app:processDebugManifestForPackage UP-TO-DATE
> Task :app:processDebugResources UP-TO-DATE
> Task :app:compileDebugKotlin UP-TO-DATE
> Task :app:javaPreCompileDebug UP-TO-DATE
> Task :app:compileDebugJavaWithJavac NO-SOURCE
> Task :app:mergeDebugShaders UP-TO-DATE
> Task :app:compileDebugShaders NO-SOURCE
> Task :app:generateDebugAssets UP-TO-DATE
> Task :app:mergeDebugAssets UP-TO-DATE
> Task :app:compressDebugAssets UP-TO-DATE
> Task :app:desugarDebugFileDependencies UP-TO-DATE
> Task :app:dexBuilderDebug UP-TO-DATE
> Task :app:mergeDebugGlobalSynthetics UP-TO-DATE
> Task :app:processDebugJavaRes UP-TO-DATE
> Task :app:mergeDebugJavaResource UP-TO-DATE
> Task :app:checkDebugDuplicateClasses UP-TO-DATE
> Task :app:mergeDebugStartupProfile UP-TO-DATE
> Task :app:mergeExtDexDebug UP-TO-DATE
> Task :app:mergeLibDexDebug UP-TO-DATE
> Task :app:mergeProjectDexDebug UP-TO-DATE
> Task :app:mergeDebugJniLibFolders UP-TO-DATE
> Task :app:mergeDebugNativeLibs NO-SOURCE
> Task :app:stripDebugDebugSymbols NO-SOURCE
> Task :app:validateSigningDebug UP-TO-DATE
> Task :app:writeDebugAppMetadata UP-TO-DATE
> Task :app:writeDebugSigningConfigVersions UP-TO-DATE
> Task :app:packageDebug UP-TO-DATE
> Task :app:createDebugApkListingFileRedirect UP-TO-DATE
> Task :app:assembleDebug UP-TO-DATE
> Task :app:bundleDebugClassesToRuntimeJar UP-TO-DATE
> Task :app:bundleDebugClassesToCompileJar UP-TO-DATE
> Task :app:compileDebugUnitTestKotlin UP-TO-DATE
> Task :app:preDebugUnitTestBuild UP-TO-DATE
> Task :app:javaPreCompileDebugUnitTest UP-TO-DATE
> Task :app:compileDebugUnitTestJavaWithJavac NO-SOURCE
> Task :app:processDebugUnitTestJavaRes UP-TO-DATE
> Task :app:testDebugUnitTest UP-TO-DATE
BUILD SUCCESSFUL in 8s
41 actionable tasks: 1 executed, 40 up-to-date
APK: android/app/build/outputs/apk/debug/app-debug.apk (6.6 MB)
JVM unit tests: LwwTest 3, TimeUtilsTest 3, CompletionMergeTest 2; 8 passed, 0 failed.
+57 -14
View File
@@ -11,14 +11,57 @@ Preset CMake variables:
-- Configuring done (0.2s)
-- Generating done (0.1s)
-- Build files have been written to: /home/misaki/MisakiCodes/Schedule/build/linux-gcc-release
[1/9] Automatic MOC and UIC for target schedule_ui
[2/8] Building Go sync server
[3/8] Building CXX object client/src/CMakeFiles/schedule_ui.dir/ui/panels/ProjectCard.cpp.o
[4/8] Linking CXX static library client/src/libschedule_ui.a
[5/8] Linking CXX executable client/tests/test_grid
[6/8] Linking CXX executable client/tests/test_mainwindow
[7/8] Linking CXX executable bin/Schedule
[8/8] Linking CXX executable client/tests/test_compactwindow
[1/61] Automatic MOC and UIC for target schedule_core
[2/60] Building Go sync server
[3/60] Building CXX object client/src/CMakeFiles/schedule_core.dir/storage/SqliteStore.cpp.o
[4/60] Linking CXX static library client/src/libschedule_core.a
[5/60] Linking CXX executable client/tests/test_scheduler
[6/60] Linking CXX executable client/tests/test_energy
[7/60] Automatic MOC and UIC for target schedule_services
[8/60] Automatic MOC and UIC for target test_storage
[9/59] Building CXX object client/src/CMakeFiles/schedule_services.dir/schedule_services_autogen/mocs_compilation.cpp.o
[10/59] Building CXX object client/src/CMakeFiles/schedule_services.dir/services/NotificationService.cpp.o
[11/59] Building CXX object client/tests/CMakeFiles/test_storage.dir/test_storage.cpp.o
[12/59] Linking CXX executable client/tests/test_storage
[13/59] Building CXX object client/src/CMakeFiles/schedule_services.dir/services/ScheduleService.cpp.o
[14/59] Linking CXX static library client/src/libschedule_services.a
[15/59] Automatic MOC and UIC for target schedule_sync
[16/58] Automatic MOC and UIC for target schedule_ai
[17/57] Linking CXX executable client/tests/test_config
[18/57] Automatic MOC and UIC for target test_services
[19/56] Building CXX object client/src/CMakeFiles/schedule_sync.dir/sync/SyncService.cpp.o
[20/56] Linking CXX static library client/src/libschedule_sync.a
[21/56] Automatic MOC and UIC for target test_sync_integration
[22/55] Building CXX object client/tests/CMakeFiles/test_services.dir/test_services.cpp.o
[23/55] Linking CXX executable client/tests/test_services
[24/55] Building CXX object client/tests/CMakeFiles/test_sync_integration.dir/test_sync_integration.cpp.o
[25/55] Linking CXX executable client/tests/test_sync_integration
[26/55] Building CXX object client/src/CMakeFiles/schedule_ai.dir/ai/AIService.cpp.o
[27/55] Linking CXX static library client/src/libschedule_ai.a
[28/55] Linking CXX executable client/tests/test_openai_provider
[29/55] Automatic MOC and UIC for target schedule_ui
[30/55] Automatic MOC and UIC for target test_ai
[31/54] Building CXX object client/tools/CMakeFiles/ai_regression.dir/ai_regression.cpp.o
[32/54] Building CXX object client/src/CMakeFiles/schedule_ui.dir/ui/dialogs/SearchDialog.cpp.o
[33/54] Linking CXX executable bin/ai_regression
[34/54] Building CXX object client/src/CMakeFiles/schedule_ui.dir/ui/dialogs/CompletedSummaryDialog.cpp.o
[35/54] Building CXX object client/src/CMakeFiles/schedule_ui.dir/schedule_ui_autogen/mocs_compilation.cpp.o
[36/54] Building CXX object client/src/CMakeFiles/schedule_ui.dir/ui/CompactWindow.cpp.o
[37/54] Building CXX object client/src/CMakeFiles/schedule_ui.dir/ui/panels/TodayPanel.cpp.o
[38/54] Building CXX object client/src/CMakeFiles/schedule_ui.dir/ui/MainWindow.cpp.o
[39/54] Linking CXX static library client/src/libschedule_ui.a
[40/54] Automatic MOC and UIC for target Schedule
[41/53] Automatic MOC and UIC for target test_mainwindow
[42/52] Linking CXX executable client/tests/test_grid
[43/52] Automatic MOC and UIC for target test_compactwindow
[44/51] Building CXX object client/tests/CMakeFiles/test_ai.dir/test_ai.cpp.o
[45/51] Linking CXX executable client/tests/test_ai
[46/51] Building CXX object client/src/CMakeFiles/Schedule.dir/main.cpp.o
[47/51] Linking CXX executable bin/Schedule
[48/51] Building CXX object client/tests/CMakeFiles/test_mainwindow.dir/test_mainwindow.cpp.o
[49/51] Linking CXX executable client/tests/test_mainwindow
[50/51] Building CXX object client/tests/CMakeFiles/test_compactwindow.dir/test_compactwindow.cpp.o
[51/51] Linking CXX executable client/tests/test_compactwindow
Installing application files...
-- Install configuration: "Release"
-- Installing: /home/misaki/MisakiCodes/Schedule/build/linux-gcc-release/AppDir/usr/./Schedule
@@ -429,12 +472,12 @@ Exportable Squashfs 4.0 filesystem, gzip compressed, data block size 131072
compressed data, compressed metadata, compressed fragments,
compressed xattrs, compressed ids
duplicates are removed
Filesystem size 34396.47 Kbytes (33.59 Mbytes)
41.70% of uncompressed filesystem size (82486.72 Kbytes)
Inode table size 4271 bytes (4.17 Kbytes)
41.77% of uncompressed inode table size (10224 bytes)
Directory table size 2463 bytes (2.41 Kbytes)
41.83% of uncompressed directory table size (5888 bytes)
Filesystem size 34417.91 Kbytes (33.61 Mbytes)
41.70% of uncompressed filesystem size (82531.28 Kbytes)
Inode table size 4272 bytes (4.17 Kbytes)
41.78% of uncompressed inode table size (10224 bytes)
Directory table size 2462 bytes (2.40 Kbytes)
41.81% of uncompressed directory table size (5888 bytes)
Number of duplicate files found 13
Number of inodes 232
Number of files 147
+1 -1
View File
@@ -1 +1 @@
4413057bb4e10df4824d1ff4dc8c009cdaafbd5fd2b91c066fca950cb97fede9 dist/AI-Schedule-0.1.0-x86_64.AppImage
49efebebbec76ce36dedf7e14fe33ee476909a122a5f0d022afd3c8e4ae87538 dist/AI-Schedule-0.1.0-x86_64.AppImage
Binary file not shown.

Before

Width:  |  Height:  |  Size: 75 KiB

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

+29
View File
@@ -0,0 +1,29 @@
Test project /home/misaki/MisakiCodes/Schedule/build/linux-gcc
Start 1: go_server_tests
1/12 Test #1: go_server_tests .................. Passed 16.80 sec
Start 2: storage
2/12 Test #2: storage .......................... Passed 0.03 sec
Start 3: services
3/12 Test #3: services ......................... Passed 0.06 sec
Start 4: grid
4/12 Test #4: grid ............................. Passed 0.38 sec
Start 5: mainwindow
5/12 Test #5: mainwindow ....................... Passed 1.25 sec
Start 6: compactwindow
6/12 Test #6: compactwindow .................... Passed 4.96 sec
Start 7: config
7/12 Test #7: config ........................... Passed 0.02 sec
Start 8: scheduler
8/12 Test #8: scheduler ........................ Passed 0.00 sec
Start 9: energy
9/12 Test #9: energy ........................... Passed 0.00 sec
Start 10: ai
10/12 Test #10: ai ............................... Passed 0.13 sec
Start 11: openai_provider
11/12 Test #11: openai_provider .................. Passed 0.21 sec
Start 12: sync_integration
12/12 Test #12: sync_integration ................. Passed 11.59 sec
100% tests passed, 0 tests failed out of 12
Total Test time (real) = 35.43 sec
+7
View File
@@ -0,0 +1,7 @@
? github.com/misaki/Schedule/server/cmd/server [no test files]
ok github.com/misaki/Schedule/server/internal/api (cached)
? github.com/misaki/Schedule/server/internal/auth [no test files]
? github.com/misaki/Schedule/server/internal/config [no test files]
? github.com/misaki/Schedule/server/internal/model [no test files]
ok github.com/misaki/Schedule/server/internal/service (cached)
ok github.com/misaki/Schedule/server/internal/store (cached)
+1 -1
View File
@@ -17,7 +17,7 @@
```text
dist/AI-Schedule-0.1.0-x86_64.AppImage
大小:约 34 MB
SHA-256:4413057bb4e10df4824d1ff4dc8c009cdaafbd5fd2b91c066fca950cb97fede9
SHA-256:49efebebbec76ce36dedf7e14fe33ee476909a122a5f0d022afd3c8e4ae87538
```
脚本会:
+80
View File
@@ -0,0 +1,80 @@
# 阶段 4.5 验证报告:已完成任务 / 长期项目汇总
> 日期:2026-10-31
> 环境:Ubuntu 24.04 / Qt 6.6.3 / Android SDK 34
## 1. 本次交付
### 1.1 桌面端
- 今日任务面板标题旁新增奖牌按钮,打开「已完成汇总」。
- 支持范围切换:本周 / 本月 / 全部。
- 统计:
- 已完成短期任务数;
- 累计专注时长;
- 已完成长期项目数;
- 连续完成天数。
- 分别列出已完成的短期任务(完成时间、原时间段)和长期项目(完成时间、截止日期)。
- 已完成长期项目从日常项目列表隐藏,但会出现在汇总中。
- 新增存储查询:按完成时间查询已完成的 timeblock;按更新时间查询 done 项目。
### 1.2 Android
- 右上角菜单新增「已完成汇总」。
- 展示短期任务数、累计专注时长、长期项目数和最近完成记录。
- 数据来自本地同步库,不额外请求服务器。
## 2. 验证
```bash
cmake --preset linux-gcc
cmake --build --preset linux-gcc --clean-first -j$(nproc)
ctest --preset linux-gcc
cd server && go test ./...
cd android && ./gradlew :app:assembleDebug :app:testDebugUnitTest
```
| 项目 | 结果 |
|---|---|
| 桌面全量构建 | 成功,0 警告 |
| 桌面 `ctest` | **12/12 通过** |
| 已完成查询测试 | `test_services::completedSummaryQueries` 通过 |
| Go 服务端 | `go test ./...` 通过 |
| Android APK | Debug 构建成功,约 6.6 MB |
| Android JVM 测试 | 8/8 通过 |
输出:
- [`ctest-phase-4-5.txt`](ctest-phase-4-5.txt)
- [`go-test-phase-4-5.txt`](go-test-phase-4-5.txt)
- [`android-build-test-phase-4-5.txt`](android-build-test-phase-4-5.txt)
## 3. 界面截图
| 截图 | 说明 |
|---|---|
| [`completed-summary-dark.png`](completed-summary-dark.png) | 已完成汇总 · 深色 |
| [`completed-summary-light.png`](completed-summary-light.png) | 已完成汇总 · 浅色 |
| [`compact-dark.png`](compact-dark.png) | 今日任务面板新增汇总入口 |
## 4. 行为说明
- 短期任务完成记录按 `done_at`(没有则使用结束时间)归档。
- 长期项目完成记录按项目状态 done + `updated_at` 归档;项目截止日期仍显示。
- 连续完成天数:从今天(今天未完成则从昨天)向前连续有完成记录的天数。
- 汇总只读取本地 SQLite,不需要网络;多设备数据通过既有同步链路进入本地。
## 5. 已知限制
1. 短期任务统计按完成的时间块计数,同一任务多个块会显示为多条记录。
2. 长期项目完成时间使用 `updated_at`,没有独立的 `completed_at` 字段。
3. 暂无周/月趋势图、日历热力图或可分享的成就卡片。
4. Android 汇总只有全部范围,桌面支持本周/本月/全部。
5. Android 长期项目仍为只读。
## 6. 人工验收建议
1. 完成一条普通日程和一个长期项目。
2. 点击今日任务面板的奖牌按钮,确认统计、连续天数和列表正确。
3. 切换本周/本月/全部,确认筛选范围生效。
4. 在 Android 菜单打开「已完成汇总」,确认能看到桌面完成的记录。
5. 重启应用后再次打开汇总,确认数据来自本地 SQLite 且不丢失。