Bug fixes
This commit is contained in:
parent
948e8ce9fc
commit
7bd4bad941
@ -2,13 +2,10 @@
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Jobs\PhotoMove;
|
||||
use App\Jobs\VideoMove;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||
|
||||
use App\Jobs\PhotoDelete;
|
||||
use App\Models\Photo;
|
||||
use App\Jobs\{PhotoDelete,VideoDelete};
|
||||
use App\Traits\Type;
|
||||
|
||||
class CatalogAutoDelete extends Command
|
||||
|
@ -36,7 +36,7 @@ class VideoController extends Controller
|
||||
return view('catalog.deletereview',[
|
||||
'catalog'=>is_null($id) ? Video::where('remove',1)->with(['software.model.make'])->paginate($this->list_deletes) : Video::where('id',$id)->paginate(1),
|
||||
'return'=>url('v/deletes'),
|
||||
'type'=>'photo',
|
||||
'type'=>'video',
|
||||
]);
|
||||
}
|
||||
|
||||
@ -45,7 +45,7 @@ class VideoController extends Controller
|
||||
return view('catalog.duplicatereview',[
|
||||
'catalog'=>is_null($id) ? Video::duplicates()->with(['software.model.make'])->paginate($this->list_duplicates) : Video::where('id',$id)->paginate(1),
|
||||
'return'=>url('v/duplicates'),
|
||||
'type'=>'photo',
|
||||
'type'=>'video',
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -132,7 +132,11 @@ abstract class Catalog extends Model
|
||||
return $query->where(function($query)
|
||||
{
|
||||
$query->where('duplicate','<>',TRUE)
|
||||
->orWhere('duplicate','=',NULL);
|
||||
->orWhere('duplicate','=',NULL)
|
||||
->orWhere(function($q) {
|
||||
$q->where('duplicate','=',TRUE)
|
||||
->where('ignore_duplicate','=',TRUE);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@ -490,7 +494,7 @@ abstract class Catalog extends Model
|
||||
|
||||
public function setDateCreated()
|
||||
{
|
||||
$this->created = $this->property('creationdate');
|
||||
$this->created = $this->property('creationdate') ?: NULL;
|
||||
}
|
||||
|
||||
public function setHeightWidth()
|
||||
|
@ -126,7 +126,7 @@ class Video extends Abstracted\Catalog
|
||||
|
||||
public function setDateCreated()
|
||||
{
|
||||
$this->created = strtotime($this->property('creationdate'));
|
||||
$this->created = $this->property('creationdate') ? strtotime($this->property('creationdate')) : NULL;
|
||||
}
|
||||
|
||||
public function setLocation()
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Traits;
|
||||
|
||||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
@ -20,7 +21,7 @@ trait Multimedia
|
||||
{
|
||||
switch (strtolower($type)) {
|
||||
case 'photo': return 'PhotoController';
|
||||
case 'video': return 'Videoontroller';
|
||||
case 'video': return 'VideoController';
|
||||
default: abort(500,'Type not handled?');
|
||||
}
|
||||
}
|
||||
@ -50,7 +51,14 @@ trait Multimedia
|
||||
private function updatePostItems(Request $request,string $class,bool $delete=FALSE)
|
||||
{
|
||||
foreach ($request->input('items') as $id) {
|
||||
$o = $class::findOrFail($id);
|
||||
try {
|
||||
$o = $class::findOrFail($id);
|
||||
} catch (ModelNotFoundException $e) {
|
||||
Log::alert('Object not found: '.$id);
|
||||
continue;
|
||||
} catch (\Exception $e) {
|
||||
dd($e);
|
||||
}
|
||||
|
||||
// Set if duplicate
|
||||
$o->duplicate = $request->input('duplicate.'.$id) ? 1 : NULL;
|
||||
@ -63,9 +71,7 @@ trait Multimedia
|
||||
|
||||
// Set if delete
|
||||
if ($delete AND $o->remove AND ($request->input('remove.'.$id) ? 1 : NULL)) {
|
||||
Log::info(sprintf('Dispatching delete for [%s]',$o->id));
|
||||
|
||||
switch ($class) {
|
||||
switch (strtolower($request->input('type'))) {
|
||||
case 'photo':
|
||||
$this->dispatch((new PhotoDelete($o))->onQueue('delete'));
|
||||
Log::info(sprintf('Dispatching delete for [%s]',$o->id));
|
||||
@ -77,7 +83,7 @@ trait Multimedia
|
||||
break;
|
||||
|
||||
default:
|
||||
Log::info(sprintf('Ignoring delete for [%s] - not configured.',$o->id));
|
||||
Log::info(sprintf('Ignoring delete for [%s] - not configured (%s).',$o->id,$class));
|
||||
}
|
||||
|
||||
} else {
|
||||
|
@ -20,7 +20,7 @@
|
||||
@section('main-content')
|
||||
<div class="row">
|
||||
<div class="col-4">
|
||||
<a href="{{ url('p/view',$o->id) }}">{!! $o->getHtmlImageURL() !!}</a>
|
||||
<a href="{{ url('v/view',$o->id) }}">{!! $o->getHtmlImageURL() !!}</a>
|
||||
|
||||
<span class="pagination justify-content-center">
|
||||
<nav>
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
<!-- /.card-body -->
|
||||
<div class="card-body">
|
||||
<a href="{{ url('v/view',$o->id) }}" target="{{ $o->id }}">{!! $o->getHtmlImageURL() !!}</a>
|
||||
{!! $o->getHtmlImageURL() !!}
|
||||
</div>
|
||||
|
||||
<!-- /.card-body -->
|
||||
|
@ -11,7 +11,7 @@
|
||||
<span class="progress-description">
|
||||
<table class="table table-borderless table-sm small">
|
||||
<tr><td>To Scan</td><td>{{ \App\Models\Photo::NotScanned()->count() }}</td></tr>
|
||||
<tr><td>Duplicate</td><td>{{ \App\Models\Photo::where('duplicate',TRUE)->count() }}</td></tr>
|
||||
<tr><td>Duplicate</td><td>{{ \App\Models\Photo::Duplicates()->count() }}</td></tr>
|
||||
<tr><td>To Delete</td><td>{{ \App\Models\Photo::where('remove',TRUE)->count() }}</td></tr>
|
||||
</table>
|
||||
</span>
|
||||
@ -34,7 +34,7 @@
|
||||
<span class="progress-description">
|
||||
<table class="table table-borderless table-sm small">
|
||||
<tr><td>To Scan</td><td>{{ \App\Models\Video::NotScanned()->count() }}</td></tr>
|
||||
<tr><td>Duplicate</td><td>{{ \App\Models\Video::where('duplicate',TRUE)->count() }}</td></tr>
|
||||
<tr><td>Duplicate</td><td>{{ \App\Models\Video::Duplicates()->count() }}</td></tr>
|
||||
<tr><td>To Delete</td><td>{{ \App\Models\Video::where('remove',TRUE)->count() }}</td></tr>
|
||||
</table>
|
||||
</span>
|
||||
|
Loading…
Reference in New Issue
Block a user