| 1 | package oEdtk::Tracking; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 4 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 4 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 4 | my ( $_TRACK_SIG, $_TRACK_TRK, @_TRACK_JSON ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 4 | ▶ | BEGIN { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=3.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 0 | ▶ | $SIG{'__WARN__'} = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | # if ($WARN2LOGGER){ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | # &logger (4, $_[0]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | # } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 0 | warn $_[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | # when Tracking object is defined, $_TRACK_TRK is defined so that events can be catch and sent to tracker | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 0 | ▶ | if ( defined $_TRACK_TRK && $_TRACK_SIG =~ /warn/i ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $_TRACK_TRK and $_TRACK_SIG =~ /warn/i
MC/DC0%0/2
defined $_TRACK_TRK and $_TRACK_SIG =~ /warn/i
defined $_TRACK_TRK
$_TRACK_SIG =~ /warn/i
Truth table0%0/3
A and B
A= defined $_TRACK_TRKB= $_TRACK_SIG =~ /warn/i
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | # http://perldoc.perl.org/functions/warn.html | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 0 | my $message = $_[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 0 | chomp($message); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 0 | $_TRACK_TRK->track( 'Warn', 1, $message ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 4 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 41 | ▶ | $SIG{'__DIE__'} = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=10.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 41 | ▶ | if ( defined $_TRACK_TRK ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 0 | my $message = $_[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 0 | chomp($message); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 0 | $_TRACK_TRK->track( 'Halt', 1, $message ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 41 | die $_[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 4 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 4 | ▶ | use oEdtk::Main; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 4 | ▶ | use oEdtk::Config qw(config_read); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 4 | ▶ | use oEdtk::DBAdmin qw(db_connect create_table_TRACKING); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 4 | ▶ | use oEdtk::logger qw(logger $WARN2LOGGER); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 4 | ▶ | use oEdtk::Dict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 4 | ▶ | use Config::IniFiles; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 4 | ▶ | use Sys::Hostname; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 4 | ▶ | use DBI; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | #use JSON; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 4 | ▶ | use Exporter; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 4 | our $VERSION = 2.1129; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 4 | our @ISA = qw(Exporter); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 4 | our @EXPORT_OK = qw(stats_iddest stats_week stats_month); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | #my @JSON_TRACE; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 2 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=27 SCAR=47.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | # example call | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | # $TRK = oEdtk::Tracking->new($ARGV[1] // '', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | # user => "utest", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | # entity => "Society", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | # keys => ['T_CALLID', 'T_TYPE', 'O_TT_TYP', 'O_TT_ID', 'T_PARAM', 'O_DESIGN', 'T_STATUT' ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | # ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 2 | my ( $class, $source, %params ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | # An explicit empty source means "no input file" and must stay empty; only | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | # an omitted source falls back to the command line. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 2 | ▶ | if ( !defined $source ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 1 | ▶ | $source = $ARGV[1] || $ARGV[0] || ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition40%2/5
$ARGV[1] || $ARGV[0] || ''
$ARGV[1] or $ARGV[0]
MC/DC0%0/2
$ARGV[1] || $ARGV[0] || ''
$ARGV[1]
$ARGV[0]
Truth table33%1/3
A or B
A= $ARGV[1]B= $ARGV[0]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 2 | ▶ | if ( $source =~ /^\-/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 0 | ▶ | $source = $ARGV[0] // ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$ARGV[0] // ""
MC/DC0%0/1
$ARGV[0] // ""
$ARGV[0]
Truth table0%0/2
A
A= $ARGV[0]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 2 | my $cfg = config_read('EDTK_DB'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | # Load the dictionary to normalize entity names. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 2 | my $dict = oEdtk::Dict->new( $cfg->{'EDTK_DICO'}, { invert => 1 } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 2 | my $mode = uc( $cfg->{'EDTK_TRACK_MODE'} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 2 | ▶ | if ( $mode eq 'NONE' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | &logger( 6, "Tracking is currently disabled... (see EDTK_TRACK_MODE in config file)" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | # Return a dummy object if tracking is disabled. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 0 | return bless { dict => $dict, mode => $mode }, $class; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 2 | my $table = $cfg->{'EDTK_DBI_TRACKING'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 2 | my $dbh = db_connect( $cfg, 'EDTK_DBI_DSN', { AutoCommit => 1 } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | # XXX Should we ensure there is at least one key defined? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 2 | ▶ | my $keys = $params{'keys'} || []; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$params{'keys'} || []
MC/DC0%0/1
$params{'keys'} || []
$params{'keys'}
Truth table50%1/2
A
A= $params{'keys'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 2 | ▶ | if ( @$keys > $cfg->{'EDTK_MAX_USER_KEY'} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 0 | die "ERROR: too many tracking keys: got " . @$keys . ", max " . $cfg->{'EDTK_MAX_USER_KEY'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | # Check that all the keys are at most 8 characters long, and otherwise | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | # truncate them. Also ensure we don't have the same key several times. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 2 | my %seen = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 2 | my @userkeys = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 2 | foreach (@$keys) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 0 | my $key = uc($_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 0 | ▶ | if ( length($key) > 8 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | $key =~ s/^(.{8}).*$/$1/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 0 | &logger( 4, "column too long, truncated to '$key'" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 0 | ▶ | if ( exists( $seen{$key} ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 0 | die "ERROR: duplicate column \"$key\""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 0 | push( @userkeys, $key ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 0 | $seen{$key} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | # Extract application name from the script name. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 2 | my $app = $0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 2 | $app =~ s/^.*?[\/\\]?([\w-]+[\.plmex]*$)/$1/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | #$app =~ s/^.*?[\/\\]?([A-Z0-9-_]+)\.pl$/$1/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 2 | ▶ | if ( length($app) > 20 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 0 | $app =~ s/\.pl$//i; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 0 | $app =~ /(.{20})$/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | &logger( 4, "application name '$app' too long, truncated to '$1'" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 0 | $app = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | # Validate the editing mode. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 2 | my $edmode = _validate_edmode( $params{'edmode'} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | # Limit username length to 10 characters per the table schema. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 2 | ▶ | my $user = $params{'user'} || 'None'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$params{'user'} || 'None'
MC/DC0%0/1
$params{'user'} || 'None'
$params{'user'}
Truth table50%1/2
A
A= $params{'user'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 2 | ▶ | if ( length($user) > 10 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 0 | $user =~ s/^(.{10}).*$/$1/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 0 | &logger( 4, "username \"$params{'user'}\" too long, truncated to \"$user\"" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | # Truncate if necessary, by taking at most 128 characters on the right. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 2 | ▶ | if ( length($source) > 128 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 0 | $source = substr( $source, -128, 128 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | my $self = bless { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | dict => $dict, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | mode => $mode, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | table => $table, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | edmode => $edmode, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | id => oe_ID_LDOC(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | seq => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | keys => \@userkeys, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | user => $user, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | source => $source, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | app => $app, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | entity => $params{'entity'} // "", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | account => $params{'account'} // "", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | obj_typ => $params{'obj_typ'} // "", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | child_typ => $params{'child_typ'} // "", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | child_id => $params{'child_id'} // "", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 2 | ▶ | parent_id => $params{'parent_id'} // "", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%6/12
$params{"entity"} // ""
$params{"account"} // ""
$params{"obj_typ"} // ""
$params{"child_typ"} // ""
$params{"child_id"} // ""
$params{"parent_id"} // ""
MC/DC0%0/1
$params{"entity"} // ""
$params{"entity"}
MC/DC0%0/1
$params{"account"} // ""
$params{"account"}
MC/DC0%0/1
$params{"obj_typ"} // ""
$params{"obj_typ"}
MC/DC0%0/1
$params{"child_typ"} // ""
$params{"child_typ"}
MC/DC0%0/1
$params{"child_id"} // ""
$params{"child_id"}
MC/DC0%0/1
$params{"parent_id"} // ""
$params{"parent_id"}
Truth table50%1/2
A
A= $params{"entity"}
Truth table50%1/2
A
A= $params{"account"}
Truth table50%1/2
A
A= $params{"obj_typ"}
Truth table50%1/2
A
A= $params{"child_typ"}
Truth table50%1/2
A
A= $params{"child_id"}
Truth table50%1/2
A
A= $params{"parent_id"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | dbh => $dbh | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | }, $class; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 2 | ▶ | my $entity = $params{'entity'} || $cfg->{'EDTK_CORP'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$params{'entity'} || $cfg->{'EDTK_CORP'}
MC/DC0%0/2
$params{'entity'} || $cfg->{'EDTK_CORP'}
$params{'entity'}
$cfg->{'EDTK_CORP'}
Truth table33%1/3
A || B
A= $params{'entity'}B= $cfg->{'EDTK_CORP'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 2 | $self->set_entity($entity); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | # Create the table in the SQLite case | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 2 | ▶ | if ( $dbh->{'Driver'}->{'Name'} eq 'SQLite' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 2 | eval { create_table_TRACKING( $dbh, $table, $cfg->{'EDTK_MAX_USER_KEY'} ); }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 2 | ▶ | if ($@) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 0 | &logger( 6, "Table already exist : $@" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 2 | $self->track( 'Job', 1, join( ' ', @ARGV ) ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | ; # keep the join to place all the free parameters in the message area | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 2 | ▶ | if ( defined $cfg->{'EDTK_TRACK_SIG'} && $cfg->{'EDTK_TRACK_SIG'} !~ /no/i ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $cfg->{"EDTK_TRACK_SIG"} and not $cfg->{"EDTK_TRACK_SIG"} =~ /no/i
MC/DC0%0/2
defined $cfg->{"EDTK_TRACK_SIG"} and not $cfg->{"EDTK_TRACK_SIG"} =~ /no/i
defined $cfg->{"EDTK_TRACK_SIG"}
not $cfg->{"EDTK_TRACK_SIG"} =~ /no/i
Truth table33%1/3
A and not(B)
A= defined $cfg->{"EDTK_TRACK_SIG"}B= not $cfg->{"EDTK_TRACK_SIG"} =~ /no/i
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 0 | $_TRACK_SIG = $cfg->{'EDTK_TRACK_SIG'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 0 | &logger( 6, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | "tracking catchs SIG messages = '$_TRACK_SIG' (see EDTK_TRACK_SIG : 'warn' for all, 'halt' for die only)" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 0 | $_TRACK_TRK = $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | # if (defined $cfg->{'EDTK_TRACK_JSON'} && $cfg->{'EDTK_TRACK_JSON'} !~/no/i ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | # # $_TRACK_TRK_JSON = $cfg->{'EDTK_TRACK_JSON'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | # push (@_TRACK_JSON, $cfg->{'EDTK_TRACK_JSON'}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | # } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | # #$_TRACK_TRK_JSON = "no"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | # $_TRACK_JSON[0] //= "no"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | # #push (@_TRACK_JSON, "no"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | # warn "INFO: _TRACK_JSON = " . @_TRACK_JSON ." \n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 2 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 7 | ▶ | sub track { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
track: called CC=23 SCAR=37.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | # example call | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | # $TRK->track('Spool', 1, "K0val", "K1val", "K2val", "Knval" ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 7 | my ( $self, $job, $count, @data ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 7 | ▶ | return if $self->{'mode'} eq 'NONE'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 7 | ▶ | $count ||= 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$count ||= 1
MC/DC0%0/1
$count ||= 1
$count
Truth table50%1/2
A
A= $count
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 7 | my @usercols = @{ $self->{'keys'} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 7 | ▶ | if ( @data > ( @usercols + 1 ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | # max is @usercols nbcol + 1 for message col | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 0 | &logger( 3, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | "Too much values : got " . @data . ", expected " . ( @usercols + 1 ) . " maximum" ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | # Validate the job event. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 7 | $job = _validate_event($job); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | # GENERATE SQL REQUEST. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | my $values = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | ED_SNGL_ID => $self->{'id'}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | ED_SEQ => $self->{'seq'}++, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | ED_TSTAMP => oe_now_time(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | ED_USER => $self->{'user'}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | ED_APP => $self->{'app'}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | ED_CORP => $self->{'entity'}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | ED_ACCOUNT => $self->{'account'} // "", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | ED_MOD_ED => $self->{'edmode'}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | ED_JOB_EVT => $job, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | ED_OBJ_TYP => $self->{'obj_typ'}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | ED_OBJ_COUNT => $count, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | ED_CHILD_TYP => $self->{'child_typ'} // "", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | ED_CHILD_ID => $self->{'child_id'} // "", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | ED_PARENT_ID => $self->{'parent_id'} // "", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | ED_HOST => hostname(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 7 | ▶ | ED_SOURCE => $self->{'source'} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%4/8
$self->{"account"} // ""
$self->{"child_typ"} // ""
$self->{"child_id"} // ""
$self->{"parent_id"} // ""
MC/DC0%0/1
$self->{"account"} // ""
$self->{"account"}
MC/DC0%0/1
$self->{"child_typ"} // ""
$self->{"child_typ"}
MC/DC0%0/1
$self->{"child_id"} // ""
$self->{"child_id"}
MC/DC0%0/1
$self->{"parent_id"} // ""
$self->{"parent_id"}
Truth table50%1/2
A
A= $self->{"account"}
Truth table50%1/2
A
A= $self->{"child_typ"}
Truth table50%1/2
A
A= $self->{"child_id"}
Truth table50%1/2
A
A= $self->{"parent_id"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 7 | foreach my $i ( 0 .. $#data ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | # add a message column to handle messages and warnings | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | # to ensure compatibility with what exists, we reverse | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | # the data to put the message first while waiting for job_evt | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | ################## PBM DATA NOT POPULATED, TO REVIEW | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | 3 | ▶ | my $val = $data[$i] // ""; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$data[$i] // ""
MC/DC0%0/1
$data[$i] // ""
$data[$i]
Truth table50%1/2
A
A= $data[$i]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 3 | ▶ | $values->{'ED_MESSAGE'} = $val . " " . ( $values->{'ED_MESSAGE'} // "" ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$values->{"ED_MESSAGE"} // ""
MC/DC0%0/1
$values->{"ED_MESSAGE"} // ""
$values->{"ED_MESSAGE"}
Truth table50%1/2
A
A= $values->{"ED_MESSAGE"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | # if there is only one data item, make sure not to put it needlessly in a user column | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 3 | ▶ | if ( $#data > 0 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | 0 | ▶ | if ( defined( $data[$i] ) && length( $data[$i] ) > 128 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $data[$i] and length $data[$i] > 128
MC/DC0%0/2
defined $data[$i] and length $data[$i] > 128
defined $data[$i]
length $data[$i] > 128
Truth table0%0/3
A and B
A= defined $data[$i]B= length $data[$i] > 128
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 0 | &logger( 4, "\"$data[$i]\" truncated to 128 characters" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 0 | $data[$i] =~ s/^(.{128}).*$/$1/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | 0 | $values->{"ED_K${i}_NAME"} = $usercols[$i]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | 0 | $values->{"ED_K${i}_VAL"} = $val; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 7 | ▶ | if ( $job eq 'W' || $job eq 'H' ) { # Halt or Warn event | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition100%3/3
$job eq "W" or $job eq "H"
MC/DC100%2/2
$job eq "W" or $job eq "H"
$job eq "W"
$job eq "H"
Truth table100%3/3
A or B
A= $job eq "W"B= $job eq "H"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | 2 | ▶ | $values->{'ED_SOURCE'} = $self->{'source'} if ( $job eq 'H' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | elsif ( $job eq 'J' ) { # JOB event | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | 4 | $values->{'ED_SOURCE'} = $self->{'source'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 1 | undef( $values->{'ED_MESSAGE'} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | # Normalize the message. When the caller supplied none, name the function | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | # that recorded the event so the row stays informative. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 7 | ▶ | my $message = $values->{'ED_MESSAGE'} // ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$values->{"ED_MESSAGE"} // ""
MC/DC100%1/1
$values->{"ED_MESSAGE"} // ""
$values->{"ED_MESSAGE"}
Truth table100%2/2
A
A= $values->{"ED_MESSAGE"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 7 | $message =~ s/\s+/ /g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 7 | $message =~ s/^ //; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | 7 | $message =~ s/ $//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | 7 | ▶ | $message = _caller_name() if $message eq ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | 7 | $message =~ s/^(.{256}).*$/$1/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 7 | $values->{'ED_MESSAGE'} = $message; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 7 | my $dbh = $self->{'dbh'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | 7 | my @cols = keys(%$values); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | 7 | my $table = $self->{'table'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | 7 | ▶ | $table = uc($table) if ( $dbh->{'Driver'}->{'Name'} eq 'mysql' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | 7 | my $sql = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | "INSERT INTO $table (" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | . join( ', ', @cols ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | . ") VALUES (" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | . join( ', ', ('?') x @cols ) . ")"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | #warn "sql = $sql \n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | #sql = insert into edtk_tracking (ed_job_evt, ed_app, ed_corp, ed_obj_typ, ed_user, ed_message, ed_tstamp, ed_sngl_id, ed_obj_count, ed_mod_ed, ed_source, ed_seq, ed_host) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | 7 | _tracking_insert( $dbh, $sql, $table, $values ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | 7 | ▶ | if ( !$dbh->{'AutoCommit'} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | 0 | ▶ | $dbh->commit or die $dbh->errstr; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | #if ($_TRACK_JSON[0] ne "no") { push (@_TRACK_JSON, $values) }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | # Name of the function that recorded the event. The Tracking package and its | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | # signal-handler closures are skipped, so the caller's code is named instead. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | 4 | ▶ | sub _caller_name { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_caller_name: called CC=7 SCAR=21.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | 4 | for my $depth ( 1 .. 10 ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | 8 | my @frame = caller($depth); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | 8 | ▶ | last unless @frame; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | 8 | ▶ | my $name = $frame[3] // ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$frame[3] // ""
MC/DC0%0/1
$frame[3] // ""
$frame[3]
Truth table50%1/2
A
A= $frame[3]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | 8 | ▶ | next if $name eq '' || $name =~ /__ANON__/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$name eq "" or $name =~ /__ANON__/
MC/DC0%0/2
$name eq "" or $name =~ /__ANON__/
$name eq ""
$name =~ /__ANON__/
Truth table33%1/3
A or B
A= $name eq ""B= $name =~ /__ANON__/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | 8 | ▶ | next if $name =~ /^oEdtk::Tracking::/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | 4 | return $name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | 0 | return 'main'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | # Run the tracking INSERT. On failure, report a stale schema (READ-ONLY) and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | # then die with the driver's message, as the historical code did. The check is | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | # fully inside eval() so it can never mask the original error. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | 7 | ▶ | sub _tracking_insert { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_tracking_insert: called CC=4 SCAR=18.6
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | 7 | my ( $dbh, $sql, $table, $values ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | 7 | my $sth; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | 7 | my $ok = eval { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | 7 | $sth = $dbh->prepare($sql); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | 7 | $sth->execute( values(%$values) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | 7 | ▶ | return if $ok; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | 0 | ▶ | my $err = ( $@ ne '' ) ? $@ : ( $sth ? $sth->errstr : $dbh->errstr ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | 0 | _tracking_schema_warn( $dbh, $table ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | 0 | die $err; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | # Warn once per process when a tracking write fails on a stale schema. The | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | # warning itself is emitted by oEdtk::DBAdmin::schema_StaleWarning (read-only). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | 4 | my $_TRACK_STALE_WARNED = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | 0 | ▶ | sub _tracking_schema_warn { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_tracking_schema_warn: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | 0 | my ( $dbh, $table ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | 0 | ▶ | return if $_TRACK_STALE_WARNED; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | 0 | ▶ | return unless $dbh; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | 0 | my $warned = eval { oEdtk::DBAdmin::schema_StaleWarning( $dbh, tracking_table => $table ); }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | 0 | ▶ | $_TRACK_STALE_WARNED = 1 if $warned; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | 2 | ▶ | sub set_entity { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_entity: called CC=3 SCAR=13.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | 2 | my ( $self, $entity ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | 2 | ▶ | if ( !defined($entity) || length($entity) == 0 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not defined $entity or length $entity == 0
MC/DC0%0/2
not defined $entity or length $entity == 0
not defined $entity
length $entity == 0
Truth table33%1/3
not(A) or B
A= not defined $entityB= length $entity == 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | 0 | &logger( 3, "Tracking::set_entity() called with an undefined entity!" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | # warn "INFO: translate >$entity< \n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | 2 | $entity = $self->{'dict'}->translate($entity); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | 2 | $self->{'entity'} = $entity; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | # warn $self->{'entity'}. " \$self->{'entity'}\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | 0 | ▶ | sub end { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
end: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | 0 | $self->track( 'Halt', 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | # For each application, for each legal entity, and for each week | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | # the number of documents in the tracking. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | 0 | ▶ | sub stats_week { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
stats_week: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | # pass the options as hash keys... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | 0 | my ( $dbh, $cfg, $start, $end, $excluded_users ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | 0 | my $table = $cfg->{'EDTK_STATS_TRACKING'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | 0 | my $innersql = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | "select ed_corp, ed_app, " | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | . "'s' || to_char(to_date(ed_tstamp, 'YYYYMMDDHH24MISS'), 'IW') as ed_week " | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | . "from $table " | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | . "where ed_job_evt = 'd' and ed_tstamp >= ? "; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | 0 | my @vals = ($start); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | 0 | ▶ | if ( defined($end) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | 0 | $innersql .= " and ed_tstamp <= ? "; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | 0 | push( @vals, $end ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | 0 | ▶ | if ( defined $excluded_users ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | 0 | my @excluded = split( /,\s*/, $excluded_users ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | 0 | ▶ | for ( my $i = 0 ; $i <= $#excluded ; $i++ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | 0 | $innersql .= " and ed_user != ? "; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | 0 | push( @vals, @excluded ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | 0 | my $sql = "select i.ed_corp, i.ed_app, i.ed_week, count(*) as ed_count " | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | . "from ($innersql) i group by ed_corp, ed_app, ed_week "; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | # warn "\nINFO: $sql \n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | #SELECT i.ED_CORP, i.ED_APP, i.ED_WEEK, COUNT(*) AS ED_COUNT | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | # FROM ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | # SELECT ED_CORP, ED_APP, 'S' || TO_CHAR(TO_DATE(ED_TSTAMP, 'YYYYMMDDHH24MISS'), 'IW') AS ED_WEEK | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | # FROM EDTK_TRACKING_2010 WHERE ED_JOB_EVT = 'D' AND ED_TSTAMP >= '20101212' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | # ) i | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | # GROUP BY ED_CORP, ED_APP, ED_WEEK; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | 0 | my $rows = $dbh->selectall_arrayref( $sql, { Slice => {} }, @vals ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | # use Data::Dumper; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | # print Dumper($rows); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | # { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | # 'ED_COUNT' => '4', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | # 'ED_APP' => 'FUS-AC007', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | # 'ED_CORP' => 'CPLTR', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | # 'ED_WEEK' => 'S51' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | # }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | 0 | return $rows; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | 0 | ▶ | sub stats_iddest { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
stats_iddest: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | # pass the options as hash keys... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | 0 | my ( $dbh, $cfg, $start, $end, $excluded_users, $ed_app ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | 0 | my $table = $cfg->{'EDTK_STATS_TRACKING'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | 0 | my $innersql = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | "select ed_corp, ed_k1_val as ed_emet, ed_k0_val as ed_iddest, ed_app, " | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | . "'s' || to_char(to_date(ed_tstamp, 'YYYYMMDDHH24MISS'), 'IW') as ed_week " | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | . "from $table " | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | . "where ed_job_evt = 'd' and ed_tstamp >= ? "; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | 0 | my @vals = ($start); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | 0 | ▶ | if ( defined($end) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | 0 | $innersql .= " and ed_tstamp <= ? "; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | 0 | push( @vals, $end ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | 0 | ▶ | if ( defined $excluded_users ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | 0 | my @excluded = split( /,\s*/, $excluded_users ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | 0 | ▶ | for ( my $i = 0 ; $i <= $#excluded ; $i++ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | 0 | $innersql .= " and ed_user != ? "; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | 0 | push( @vals, @excluded ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | 0 | ▶ | if ( defined $ed_app ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | 0 | $innersql .= " and ed_app = ? "; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | 0 | push( @vals, $ed_app ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | 0 | my $sql = "select i.ed_corp, i.ed_emet, i.ed_iddest, i.ed_app, i.ed_week, count(*) as ed_count " | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | . "from ($innersql) i group by i.ed_corp, i.ed_emet, i.ed_iddest, i.ed_app, i.ed_week "; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | # warn "INFO: $sql \n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | # warn "INFO: @vals \n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | # SELECT i.ED_CORP, i.ED_SECTION, i.ED_IDDEST, i.ED_APP, i.ED_WEEK, COUNT(*) AS ED_COUNT | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | # FROM ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | # SELECT ED_CORP, ED_K1_VAL AS ED_SECTION, ED_K0_VAL AS ED_IDDEST, ED_APP, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | # 'S' || TO_CHAR(TO_DATE(ED_TSTAMP, 'YYYYMMDDHH24MISS'), 'IW') AS ED_WEEK | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | # FROM EDTK_TRACKING_2010 WHERE ED_JOB_EVT = 'D' AND ED_TSTAMP >= ? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | # AND ED_TSTAMP <= ? AND ED_USER != ? AND ED_APP = ? ) i | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | # GROUP BY i.ED_CORP, i.ED_SECTION, i.ED_IDDEST, i.ED_APP, i.ED_WEEK | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | 0 | my $rows = $dbh->selectall_arrayref( $sql, { Slice => {} }, @vals ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | # use Data::Dumper; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | # print Dumper($rows); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | # { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | # 'ED_COUNT' => '2', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | # 'ED_APP' => 'CTP-AC001', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | # 'ED_IDDEST' => '0000428193', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | # 'ED_CORP' => 'CORP_1', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | # 'ED_WEEK' => 'S50', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | # 'ED_EMET' => 'P004' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | # }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | 0 | return $rows; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | # For each application, for each E.R., for each legal entity | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | # and for each month, the number of documents in the tracking. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | 0 | ▶ | sub stats_month { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
stats_month: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | 0 | my ( $dbh, $cfg, $start, $end, $excluded_users ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | 0 | my $table = $cfg->{'EDTK_STATS_TRACKING'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | 0 | my $innersql = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | "select ed_app, ed_corp, ed_k1_val as ed_emet, " | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | . "'m' || to_char(to_date(ed_tstamp, 'YYYYMMDDHH24MISS'), 'MM') as ed_month " | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | . "from $table where ed_job_evt = 'd' and ed_tstamp >= ? "; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | 0 | my @vals = ($start); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | 0 | ▶ | if ( defined($end) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | 0 | $innersql .= " and ed_tstamp <= ? "; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | 0 | push( @vals, $end ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | 0 | ▶ | if ( defined $excluded_users ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | 0 | my @excluded = split( /,\s*/, $excluded_users ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | 0 | ▶ | for ( my $i = 0 ; $i <= $#excluded ; $i++ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | 0 | $innersql .= " and ed_user != ? "; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | 0 | push( @vals, @excluded ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | 0 | my $sql = "select i.ed_app, i.ed_corp, i.ed_emet, i.ed_month, count(*) as ed_count " | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | . "from ($innersql) i group by ed_app, ed_corp, ed_emet, ed_month "; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | 0 | my $rows = $dbh->selectall_arrayref( $sql, { Slice => {} }, @vals ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | # use Data::Dumper; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | # print Dumper($rows); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | # 'ED_MONTH' => 'M12', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | # 'ED_COUNT' => '1', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | # 'ED_CORP' => 'CORP_1', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | # 'ED_APP' => 'DEV-CAMELEON', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | # 'ED_EMET' => '37043' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | 0 | return $rows; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | 19 | ▶ | sub _validate_event { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_validate_event: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | # Job Event : looking for one of the following : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | # Job (default), Spool, Document, Line, Warning, Error, Halt (critic), Reject, Track | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | 19 | my $job = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | 19 | ▶ | &logger( 3, "Halt event in Tracking = $job" ) if ( $job =~ /^H/ ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | 19 | ▶ | if ( !defined $job || $job !~ /^([JSDLWEHRT])/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $job and $job =~ /^([JSDLWEHRT])/
MC/DC100%2/2
defined $job and $job =~ /^([JSDLWEHRT])/
defined $job
$job =~ /^([JSDLWEHRT])/
Truth table100%3/3
A and B
A= defined $jobB= $job =~ /^([JSDLWEHRT])/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | 2 | ▶ | die "ERROR: Invalid job event : " | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | . ( defined $job ? $job : '(undef)' ) . "\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | . "\t valid events are : Job / Spool / Document / Line / Warning / Reject / Error / Halt (critic)\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | 17 | return $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | #{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | #my $_edmode; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | # sub display_edmode { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | # if (!defined $_edmode) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | # $_edmode = _validate_edmode(shift); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | # return $_edmode; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | 12 | ▶ | sub _validate_edmode { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_validate_edmode: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | # Printing Mode : looking for one of the following : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | # Undef (default), Batch, Tp, Web, Mail, probinG | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | 12 | my $edmode = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | 12 | ▶ | if ( !defined $edmode || $edmode !~ /^([BTMWG])/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $edmode and $edmode =~ /^([BTMWG])/
MC/DC100%2/2
defined $edmode and $edmode =~ /^([BTMWG])/
defined $edmode
$edmode =~ /^([BTMWG])/
Truth table100%3/3
A and B
A= defined $edmodeB= $edmode =~ /^([BTMWG])/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | 7 | return 'U'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | 5 | return $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | #} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | #END { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | # #if ($_TRACK_TRK_JSON !~/no/i) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | # if ($_TRACK_JSON[0] ne "no") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | # my $json = JSON->new; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | # #print $json->encode(\@_TRACK_JSON); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | #} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | 4 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | oEdtk::Tracking - object-oriented production tracking | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | use oEdtk::Tracking qw(stats_week); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | my $trk = oEdtk::Tracking->new($source, user => 'utest', entity => 'Corp'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | $trk->track('Job', 1, @values); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | $trk->end; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | Records tracking events (job, spool, document, warn, halt) for a batch run into | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | the table named by the C<EDTK_DB> configuration, and offers a few statistics | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | queries over that table. When C<EDTK_TRACK_MODE> is C<NONE> the constructor | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | returns an inert object and every method becomes a no-op. This is the current | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | module; C<Tracking2.pm> is the older, warn-based duplicate that declares the same | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | package C<oEdtk::Tracking>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | =head1 METHODS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | =head2 new | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | my $trk = oEdtk::Tracking->new($source, %params); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | Build a tracker. C<$source> names the input, and C<%params> may carry C<user>, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | C<entity>, C<keys>, C<edmode>, C<account>, C<obj_typ>, C<child_typ>, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | C<child_id> and C<parent_id>. An omitted C<$source> falls back to C<@ARGV>; an | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | explicit empty string means no input file and is kept. Dies when there are too | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | many keys or a duplicate key. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | =head2 track | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | $trk->track($job, $count, @data); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | Record one event: the job event, the number of objects, and the values of the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 606 | configured user keys (an optional trailing value is the message). Values longer | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 607 | than the schema allows are truncated. When no message is supplied, C<ED_MESSAGE> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 608 | names the function that recorded the event. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 609 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 610 | =head2 set_entity | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 611 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 612 | $trk->set_entity($entity); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 613 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 614 | Normalise C<$entity> through the dictionary and store it. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 615 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 616 | =head2 end | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 617 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 618 | $trk->end; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 619 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 620 | Record the final C<Halt> event. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 621 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 622 | =head1 FUNCTIONS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 623 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 624 | =head2 stats_iddest | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 625 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 626 | my $rows = stats_iddest($dbh, $cfg, $start, $end, $excluded_users, $ed_app); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 627 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 628 | Per recipient destination, per week, the number of documents tracked between | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 629 | C<$start> and C<$end>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 630 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 631 | =head2 stats_week | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 632 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 633 | my $rows = stats_week($dbh, $cfg, $start, $end, $excluded_users); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 634 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 635 | Per application, per legal entity and per ISO week, the number of documents | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 636 | tracked during the period. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 637 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 638 | =head2 stats_month | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 639 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 640 | my $rows = stats_month($dbh, $cfg, $start, $end, $excluded_users); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 641 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 642 | Per application, per legal entity and per month, the number of documents tracked | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 643 | during the period. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 644 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 645 | The following subs are internal helpers and are not part of the public API: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 646 | C<_tracking_insert>, C<_tracking_schema_warn>, C<_validate_event> and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 647 | C<_validate_edmode>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 648 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 649 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 650 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 651 | The oEdtk team. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 652 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 653 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||