fix transaction list in admin and speed up external count
This commit is contained in:
parent
962cf972da
commit
d484b342df
2 changed files with 6 additions and 5 deletions
|
@ -18,8 +18,8 @@ sub index {
|
||||||
{},
|
{},
|
||||||
{
|
{
|
||||||
select => [
|
select => [
|
||||||
{ count => 'id', '-as' => 'count' },
|
{ count => 'me.value', '-as' => 'count' },
|
||||||
{ sum => 'value', '-as' => 'sum_value' },
|
{ sum => 'me.value', '-as' => 'sum_value' },
|
||||||
'quantised_weeks',
|
'quantised_weeks',
|
||||||
],
|
],
|
||||||
group_by => 'quantised_weeks',
|
group_by => 'quantised_weeks',
|
||||||
|
|
|
@ -199,14 +199,15 @@ sub post_supplier_count {
|
||||||
buyer_id => $user->entity->id,
|
buyer_id => $user->entity->id,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prefetch => { 'seller' => 'organisation' },
|
join => { 'seller' => 'organisation' },
|
||||||
select => [
|
select => [
|
||||||
{ count => 'me.id', '-as' => 'count' },
|
{ count => 'me.id', '-as' => 'count' },
|
||||||
{ sum => 'me.value', '-as' => 'total_spend' },
|
{ sum => 'me.value', '-as' => 'total_spend' },
|
||||||
'organisation.name',
|
'organisation.name',
|
||||||
'me.quantised_days',
|
'me.quantised_days',
|
||||||
],
|
],
|
||||||
group_by => [ 'me.quantised_days', 'seller.id' ],
|
as => [ qw/ count total_spend name quantised_days / ],
|
||||||
|
group_by => [ qw/ me.quantised_days seller.id organisation.id / ],
|
||||||
order_by => { '-asc' => 'me.quantised_days' },
|
order_by => { '-asc' => 'me.quantised_days' },
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -216,7 +217,7 @@ sub post_supplier_count {
|
||||||
count => $_->get_column('count'),
|
count => $_->get_column('count'),
|
||||||
value => ($_->get_column('total_spend') / 100000) // 0,
|
value => ($_->get_column('total_spend') / 100000) // 0,
|
||||||
date => $_->get_column('quantised_days'),
|
date => $_->get_column('quantised_days'),
|
||||||
seller => $_->seller->organisation->name,
|
seller => $_->get_column('name'),
|
||||||
}} $spend_rs->all,
|
}} $spend_rs->all,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Reference in a new issue