Add hourly seller chart for single-day ranges
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 1m35s
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 1m35s
This commit is contained in:
@@ -159,6 +159,12 @@ test('getDashboardAnalytics includes seller revenue and order metrics', async ()
|
||||
};
|
||||
}
|
||||
|
||||
if (sql.includes('order_hour')) {
|
||||
return {
|
||||
rows: [{ id: '977226210', name: 'KEDMA DA SILVA', hour: 14, value: 300, orders: 1 }]
|
||||
};
|
||||
}
|
||||
|
||||
if (sql.includes('seller_orders') && sql.includes('SUM(quantidade * valor_unitario)')) {
|
||||
return {
|
||||
rows: [{ id: '977226210', name: 'KEDMA DA SILVA', value: 750 }]
|
||||
@@ -187,7 +193,7 @@ test('getDashboardAnalytics includes seller revenue and order metrics', async ()
|
||||
const sellerRevenueQuery = calls.find(call => call.sql.includes('seller_orders') && call.sql.includes('SUM(quantidade * valor_unitario)'));
|
||||
const sellerOrdersQuery = calls.find(call => call.sql.includes('seller_orders') && call.sql.includes('COUNT(DISTINCT'));
|
||||
|
||||
assert.equal(calls.length, 6);
|
||||
assert.equal(calls.length, 7);
|
||||
calls.forEach(call => {
|
||||
assert.deepEqual(call.params, ['2026-06-01', '2026-06-24']);
|
||||
});
|
||||
@@ -203,6 +209,9 @@ test('getDashboardAnalytics includes seller revenue and order metrics', async ()
|
||||
assert.deepEqual(dashboard.sellerRevenueByDate, [
|
||||
{ id: '977226210', name: 'KEDMA DA SILVA', date: '2026-06-05', value: 400, orders: 2 }
|
||||
]);
|
||||
assert.deepEqual(dashboard.sellerRevenueByHour, [
|
||||
{ id: '977226210', name: 'KEDMA DA SILVA', hour: 14, value: 300, orders: 1 }
|
||||
]);
|
||||
} finally {
|
||||
pool.query = originalQuery;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user