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:
@@ -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;
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user