Merge feature/asset-statistics into main and release v1.2.1
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
shishengliang
2026-09-23 14:28:26 +08:00
116 changed files with 18694 additions and 4137 deletions
@@ -49,7 +49,7 @@ test('keeps all vehicle GET endpoints in their established order', () => {
assert.doesNotMatch(source, /\bSELECT\b|pool\.query|MAIN_SQL/);
});
test('keeps the non-empty vehicle cache for less than 60 seconds', async () => {
test('keeps the non-empty vehicle cache for less than 5 seconds', async () => {
let now = 100_000;
const db = new FakeDatabase([[{ id: 'first' }], [{ id: 'second' }]]);
const repository = new VehicleRepository(
@@ -59,7 +59,7 @@ test('keeps the non-empty vehicle cache for less than 60 seconds', async () => {
);
assert.deepEqual(await repository.getVehicles(), [vehicle('first')]);
now += 59_999;
now += 4_999;
assert.deepEqual(await repository.getVehicles(), [vehicle('first')]);
now += 1;
assert.deepEqual(await repository.getVehicles(), [vehicle('second')]);
@@ -145,9 +145,9 @@ test('replacement trips come exclusively from linked delivery records', () => {
assert.doesNotMatch(FLOW_STATS_SQL, /FROM vehicle_replacement|dv\.delivery_time|r\.arrival_time|vr\.replace_time/);
});
test('completed delivery and replacement trips use vehicle status and exclude suspended subjects', () => {
test('delivery and replacement trips include awaiting customer signature and exclude suspended subjects', () => {
const [deliveries, returns] = FLOW_STATS_SQL.split('UNION ALL');
assert.ok(deliveries.includes('AND dv.delivery_status IN (2,3,20)'));
assert.ok(deliveries.includes('AND dv.delivery_status IN (2,3,5,20)'));
assert.ok(deliveries.includes('AND (dts.status IS NULL OR dts.status <> 10)'));
assert.doesNotMatch(deliveries, /dts\.status\s*(?:=|IN)|dv\.delivery_status IN \(2,3,5\)/);
assert.ok(returns.includes('AND r.status IN (2,3,5)'));