test(analytics): cover net category semantics
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { pool } from '../db/pool';
|
||||
import { effectiveAmountCase } from './analyticsSemantics';
|
||||
import type {
|
||||
AnalyticsSummaryResponse,
|
||||
TopCategory,
|
||||
@@ -14,14 +15,7 @@ interface BaseParams {
|
||||
onlyConfirmed?: boolean;
|
||||
}
|
||||
|
||||
const effectiveAmount = `
|
||||
CASE
|
||||
WHEN t.amount_signed = 0 AND t.commission > 0
|
||||
AND t.description ILIKE '%зачисление%'
|
||||
THEN t.commission
|
||||
WHEN t.amount_signed < 0 THEN t.amount_signed - t.commission
|
||||
ELSE t.amount_signed + t.commission
|
||||
END`;
|
||||
const effectiveAmount = effectiveAmountCase('t');
|
||||
|
||||
function analyticsTransactions(where: string): string {
|
||||
return `
|
||||
|
||||
Reference in New Issue
Block a user