dispatch the ProjectDownloadJob

This commit is contained in:
guillaume91 2024-06-26 14:29:14 +02:00
parent 03564772aa
commit 42eb932ff8
2 changed files with 5 additions and 5 deletions

View file

@ -10,7 +10,7 @@ class DownloadNotification extends Component
{ {
public $show_download_notification; public $show_download_notification;
public Project $project; public Project $project;
// TODO Change session bool to timestamp so i can check if i show it in 5 min.
public function mount(Project $project) public function mount(Project $project)
{ {
$this->show_download_notification = session()->get('show-download.'.$project->id,$project->hasMissingDownloadsDateInHarvestFile()); $this->show_download_notification = session()->get('show-download.'.$project->id,$project->hasMissingDownloadsDateInHarvestFile());

View file

@ -350,18 +350,18 @@ public function getMosaicsFor(Carbon $endDate, int $offset= 7): array
public function handleMissingDownloads() public function handleMissingDownloads()
{ {
$this->getMissingDownloadsDateInHarvestFile() $this->getMissingDownloads()
->each(function(Carbon $date){ ->each(function(Carbon $date){
ProjectDownloadTiffJob::handleForDate($this,$date); dispatch(ProjectDownloadTiffJob::handleForDate($this,$date));
}); });
} }
public function hasMissingDownloadsDateInHarvestFile():bool public function hasMissingDownloadsDateInHarvestFile():bool
{ {
return $this->getMissingDownloadsDateInHarvestFile()->count() > 0; return $this->getMissingDownloads()->count() > 0;
} }
public function getMissingDownloadsDateInHarvestFile():Collection public function getMissingDownloads():Collection
{ {
if(!$this->harvest_json_path || !$this->min_harvest_date){ if(!$this->harvest_json_path || !$this->min_harvest_date){
return collect([]); return collect([]);