diff --git a/app/Http/Controllers/ExportController.php b/app/Http/Controllers/ExportController.php index 828b65683d..9c8c1e64c7 100644 --- a/app/Http/Controllers/ExportController.php +++ b/app/Http/Controllers/ExportController.php @@ -48,6 +48,8 @@ class ExportController extends Controller $name = 'Export job on ' . $date . '.zip'; $quoted = sprintf('"%s"', addcslashes($name, '"\\')); + $job->change('export_downloaded'); + return response(file_get_contents($file), 200) ->header('Content-Description', 'File Transfer') diff --git a/app/Repositories/ExportJob/ExportJobRepository.php b/app/Repositories/ExportJob/ExportJobRepository.php index 8125c61033..20fe195cf1 100644 --- a/app/Repositories/ExportJob/ExportJobRepository.php +++ b/app/Repositories/ExportJob/ExportJobRepository.php @@ -29,8 +29,7 @@ class ExportJobRepository implements ExportJobRepositoryInterface { $dayAgo = Carbon::create()->subDay(); ExportJob::where('created_at', '<', $dayAgo->format('Y-m-d H:i:s')) - ->where('status', 'never_started') - // TODO also delete others. + ->whereIn('status', ['never_started', 'export_status_finished', 'export_downloaded']) ->delete(); return true;