Fix broadband traffic import, when new services cannot be found. Fix broadband update so that start_at = connect_at

This commit is contained in:
Deon George
2022-09-29 11:22:16 +10:00
parent 5b4aa5c73e
commit 1667b8c1df
2 changed files with 14 additions and 3 deletions

View File

@@ -106,7 +106,6 @@ final class BroadbandTraffic implements ShouldQueue
->single();
$to = new UsageBroadband;
$to->site_id = $oo->site_id;
$to->date = $last_update;
$to->supplier_id = $this->o->id;
$to->up_peak = $row[$o->getColumnKey('Peak upload')];
@@ -122,8 +121,10 @@ final class BroadbandTraffic implements ShouldQueue
Log::error(sprintf('%s:Too many services return for [%s]',self::LOGKEY,$row[$o->getColumnKey('Login')]),['date'=>$date,'count'=>$oo->count()]);
$to->service = $row[$o->getColumnKey('Login')];
$to->site_id = 1; // @todo This needs to be worked out a better way
} else {
$to->site_id = $oo->site_id;
$to->service_item_id = $oo->id;
}
@@ -131,9 +132,8 @@ final class BroadbandTraffic implements ShouldQueue
$u++;
} catch (\Exception $e) {
dump($to);
Log::error(sprintf('%s:Exception occurred when storing traffic record for [%s].',self::LOGKEY,$row[$o->getColumnKey('Login')]),['row'=>$row,'line'=>$line]);
throw new \Exception('Error while storing traffic date');
throw new \Exception('Error while storing traffic data: '.$e->getMessage());
}
}
Log::info(sprintf('%s: Records Imported [%d] for [%s]',self::LOGKEY,$u,$last_update->format('Y-m-d')));