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:
@@ -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