MT#21303 cdr-exporter does not update cdr status

+also checked event-exporter, its fine there.

Change-Id: I93b991872423e6b4c6d282d241665de4e3b39dfb
changes/47/7047/2
Rene Krenn 10 years ago
parent db0d13800b
commit b0d3eaaffb

@ -12,13 +12,9 @@ use NGCP::CDR::Exporter;
NGCP::CDR::Exporter::get_config('exporter', 'cdr-exporter.conf');
print("+++ Start run with DB " . (confval('DBUSER') || "(undef)") .
"\@".confval('DBDB')." to ".confval('PREFIX')."\n");
# add fields we definitely need, will be removed during processing
unshift @NGCP::CDR::Exporter::admin_fields, qw/
accounting.cdr.id
@ -27,28 +23,21 @@ unshift @NGCP::CDR::Exporter::admin_fields, qw/
accounting.cdr.source_provider_id
accounting.cdr.destination_provider_id
/;
my @trailer = (
{ 'order by' => 'accounting.cdr.id' },
);
# working vars at beginning:
my @ignored_ids = ();
my @ids = ();
NGCP::CDR::Exporter::prepare_dbh(\@trailer, 'accounting.cdr');
NGCP::CDR::Exporter::prepare_output();
NGCP::CDR::Exporter::run(\&callback);
my @ignored_ids = ();
my @ids;
sub filestats_callback {
my ($data_row, $ref) = @_;
@ -104,14 +93,8 @@ sub callback {
#DEBUG "ignoring cdr ids " . (join ",", @ignored_ids);
NGCP::CDR::Exporter::finish();
update_export_status("accounting.cdr", \@ids, "ok");
# TODO: should be tagged as ignored/skipped/whatever
update_export_status("accounting.cdr", \@ignored_ids, "ok");

@ -46,10 +46,6 @@ my @filter_ids = ();
NGCP::CDR::Exporter::run(\&callback);
sub callback {
my ($row, $res_row) = @_;
my $quotes = NGCP::CDR::Exporter::confval('QUOTES');
@ -75,7 +71,7 @@ sub callback {
my $k = "$sub_id;$t;$old";
my $ids = $filter{$k} // [];
if(@{ $ids }) {
my $old_id = pop @{ $ids };
my $old_id = pop @{ $ids };
say "... id $id is an update event of id $old_id, merge";
delete $lines{$old_id};
$res_id and delete $res_lines{$res_id}{$old_id};
@ -97,7 +93,7 @@ sub callback {
my $k = "$sub_id;$t;$old";
my $ids = $filter{$k} // [];
if(@{ $ids }) {
my $old_id = pop @{ $ids };
my $old_id = pop @{ $ids };
say "... id $id is an end event of id $old_id, filter";
push @filter_ids, ($id, $old_id);
delete $lines{$old_id};
@ -133,20 +129,13 @@ for my $res (keys(%res_lines)) {
}
}
NGCP::CDR::Exporter::finish();
my @ids = keys %lines;
update_export_status("accounting.events", \@filter_ids, "filtered");
update_export_status("accounting.events", \@ids, "ok");
NGCP::CDR::Exporter::commit();
# vim: set tabstop=4 expandtab:

Loading…
Cancel
Save