Skip to content

Commit

Permalink
MT#19981 align dashboard customer count query
Browse files Browse the repository at this point in the history
Change-Id: Iff650b3e30d0ef2bc15612c7a310085218055e8f
  • Loading branch information
Rene Krenn committed Oct 3, 2016
1 parent 66ea5df commit 6fa78d1
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions lib/NGCP/Panel/Widget/Dashboard/AdminResellerOverview.pm
Expand Up @@ -2,6 +2,7 @@ package NGCP::Panel::Widget::Dashboard::AdminResellerOverview;

use warnings;
use strict;
use NGCP::Panel::Utils::DateTime qw();

sub template {
return 'widgets/admin_reseller_overview.tt';
Expand Down Expand Up @@ -34,12 +35,19 @@ sub _prepare_domains_count {

sub _prepare_customers_count {
my ($self, $c) = @_;
my $now = NGCP::Panel::Utils::DateTime::current_local;
my $dtf = $c->model('DB')->storage->datetime_parser;
$c->stash(
customers => $c->model('DB')->resultset('contracts')->search_rs({
status => { '!=' => 'terminated' },
'product.class' => { 'not in' => [ 'reseller', 'sippeering', 'pstnpeering' ] },
}, {
join => { 'billing_mappings' => 'product' },
customers => $c->model('DB')->resultset('contracts')->search({
'me.status' => { '!=' => 'terminated' },
'contact.reseller_id' => { '-not' => undef },
'-or' => [
'product.class' => 'sipaccount',
'product.class' => 'pbxaccount',
],
},{
bind => [ ( $dtf->format_datetime($now) ) x 2, undef, undef ],
'join' => [ 'contact', { 'billing_mappings_actual' => { 'billing_mappings' => 'product'}} ],
}),
);
}
Expand Down

0 comments on commit 6fa78d1

Please sign in to comment.