Ham handed attempt to try and find the maximum revision date.
This commit is contained in:
parent
4e0e62b202
commit
b80b044202
1 changed files with 6 additions and 1 deletions
|
|
@ -65,11 +65,14 @@ my $totalAsset = $session->db->quickScalar('SELECT COUNT(*) FROM asset');
|
||||||
my $totalAssetData = $session->db->quickScalar('SELECT COUNT( DISTINCT( assetId ) ) FROM assetData' );
|
my $totalAssetData = $session->db->quickScalar('SELECT COUNT( DISTINCT( assetId ) ) FROM assetData' );
|
||||||
my $total = $totalAsset >= $totalAssetData ? $totalAsset : $totalAssetData;
|
my $total = $totalAsset >= $totalAssetData ? $totalAsset : $totalAssetData;
|
||||||
|
|
||||||
# Order by to put corrupt parents before corrupt children
|
# Order by lineage to put corrupt parents before corrupt children
|
||||||
# Join assetData to get all asset and assetData
|
# Join assetData to get all asset and assetData
|
||||||
my $sql = "SELECT * FROM asset LEFT JOIN assetData USING ( assetId ) GROUP BY assetId ORDER BY lineage ASC";
|
my $sql = "SELECT * FROM asset LEFT JOIN assetData USING ( assetId ) GROUP BY assetId ORDER BY lineage ASC";
|
||||||
my $sth = $session->db->read($sql);
|
my $sth = $session->db->read($sql);
|
||||||
|
|
||||||
|
##Guarantee that we get the most recent revisionDate
|
||||||
|
my $max_revision = $session->db->prepare('select max(revisionDate) from assetData where assetId=?');
|
||||||
|
|
||||||
my $count = 1;
|
my $count = 1;
|
||||||
my %classTables; # Cache definition lookups
|
my %classTables; # Cache definition lookups
|
||||||
while ( my %row = $sth->hash ) {
|
while ( my %row = $sth->hash ) {
|
||||||
|
|
@ -85,6 +88,8 @@ while ( my %row = $sth->hash ) {
|
||||||
eval "require $row{className}";
|
eval "require $row{className}";
|
||||||
[ map { $_->{tableName} } reverse @{ $row{className}->definition($session) } ];
|
[ map { $_->{tableName} } reverse @{ $row{className}->definition($session) } ];
|
||||||
};
|
};
|
||||||
|
$max_revision->execute([$row{assetId}]);
|
||||||
|
($row{revisionDate}) = $max_revision->array();
|
||||||
$row{revisionDate} ||= time;
|
$row{revisionDate} ||= time;
|
||||||
|
|
||||||
for my $table ( @{$classTables} ) {
|
for my $table ( @{$classTables} ) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue