fix: customers without transactions are now returned on the gql query

style: added stripes as bg to table rows

feat: created the stripped lines pattern for null values in tables

style: center objects vertically in the tables

fix: removed the vertical alignment on the Td component (broke some
tables)

fix: coalesce the last_active customer property to it's own creation
when there's no tx associated

fix: check for null values in the customer properties

fix: fix the ordering of the customers table

style: centered td contents vertically
This commit is contained in:
Liordino Neto 2020-03-24 23:31:18 -03:00 committed by Josh Harvey
parent 7885d56211
commit 2a1356d192
3 changed files with 26 additions and 17 deletions

View file

@ -386,14 +386,16 @@ function batch () {
*/
function getCustomersList () {
const sql = `select name, phone, total_txs, total_spent,
created as last_active, fiat as last_tx_fiat, fiat_code as last_tx_fiat_code,
coalesce(tx_created, customer_created) as last_active,
fiat as last_tx_fiat, fiat_code as last_tx_fiat_code,
tx_class as last_tx_class
from (
select c.name, c.phone, t.tx_class, t.fiat, t.fiat_code, t.created,
select c.name, c.phone, c.created as customer_created,
t.tx_class, t.fiat, t.fiat_code, t.created as tx_created,
row_number() over (partition by c.id order by t.created desc) as rn,
count(0) over (partition by c.id) as total_txs,
sum(t.fiat) over (partition by c.id) as total_spent
from customers c inner join (
sum(case when t.id is not null then 1 else 0 end) over (partition by c.id) as total_txs,
coalesce(sum(t.fiat) over (partition by c.id), 0) as total_spent
from customers c left outer join (
select 'cashIn' as tx_class, id, fiat, fiat_code, created, customer_id
from cash_in_txs where send_confirmed = true union
select 'cashOut' as tx_class, id, fiat, fiat_code, created, customer_id