Fix multiple export & no stats on cron when 0
This commit is contained in:
parent
9fe5ad3539
commit
31dba136d9
3 changed files with 15 additions and 11 deletions
|
|
@ -133,12 +133,14 @@ class Kernel extends ConsoleKernel
|
|||
}
|
||||
}
|
||||
// ---- Insertion en base de stats
|
||||
$stat = new Statistique();
|
||||
$stat->stat_campId = $campagne->camp_id;
|
||||
$stat->stat_couponId = $coupon->coupon_id;
|
||||
$stat->stat_couponPrinted = $count;
|
||||
if($count > 0){
|
||||
$stat = new Statistique();
|
||||
$stat->stat_campId = $campagne->camp_id;
|
||||
$stat->stat_couponId = $coupon->coupon_id;
|
||||
$stat->stat_couponPrinted = $count;
|
||||
|
||||
$stat->save();
|
||||
$stat->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
})->everyFifteenMinutes();
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ class ExportController extends Controller
|
|||
|
||||
$labels = $this->getLabelsForStats($startdate, $enddate);
|
||||
|
||||
|
||||
$paths = array();
|
||||
|
||||
foreach ($coupons as $coupon) {
|
||||
$cpName = str_replace(' ', '', $coupon->coupon_name);
|
||||
|
|
@ -80,8 +80,9 @@ class ExportController extends Controller
|
|||
|
||||
$pdf->loadHTML($view);
|
||||
$pdf->save($full_path);
|
||||
array_push($paths, $fullpath);
|
||||
}
|
||||
|
||||
return json_encode($full_path);
|
||||
return json_encode($paths);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,10 +54,11 @@
|
|||
enddate: $('#enddate').val(),
|
||||
},
|
||||
dataType: 'JSON',
|
||||
success: function (response) {
|
||||
$('.dl-pdf').attr("href", '/'+response);
|
||||
$('.dl-pdf').get(0).click();
|
||||
|
||||
success: function (response) {
|
||||
$.each(response, function(index, element){
|
||||
$('.dl-pdf').attr("href", '/'+element);
|
||||
$('.dl-pdf').get(0).click();
|
||||
})
|
||||
},
|
||||
error: function (e) {
|
||||
console.log(e.responseText);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue