From 4fb78b48d145b9fb1a03409f4b0c3a0d45ad6306 Mon Sep 17 00:00:00 2001 From: Anthony Clark Date: Tue, 7 May 2024 15:41:42 -0700 Subject: [PATCH] Improve seeder validation output --- app/Console/Commands/ValidateSeeder.php | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/app/Console/Commands/ValidateSeeder.php b/app/Console/Commands/ValidateSeeder.php index e119c46..e61bb26 100644 --- a/app/Console/Commands/ValidateSeeder.php +++ b/app/Console/Commands/ValidateSeeder.php @@ -46,7 +46,8 @@ public function handle() 'Artwork', $artwork, $translation, - $locale + $locale, + ['theme' => $theme, 'prompt' => $prompt, 'artwork' => $artwork] )) ) ); @@ -58,7 +59,8 @@ private function checkImg( string $type, array $object, array $translation, - string $locale + string $locale, + array $meta = [] ): void { $url1 = Arr::get($object, $field); $url2 = Arr::get($translation, $field); @@ -66,13 +68,23 @@ private function checkImg( if ($url1 !== $url2) { $similarity = $this->getSimilarity($url1, $url2); - if ($similarity > 70) { + if ($similarity > 50) { return; } - $this->error($type.' '.$object['id'].' Img:'.$url1); - $this->error(Str::upper($locale).' '.$type.' '.$translation['id'].' Img:'.$url2); - $this->error('Similarity: '.$similarity); + if ($type === 'Theme') { + $this->comment('Theme: '.$object['title']); + } + + if ($type === 'Artwork') { + $this->comment('Theme: '.$meta['theme']['title']); + $this->comment('Prompt: '.$meta['prompt']['title']); + $this->comment('Artwork: '.$meta['artwork']['title']); + } + + $this->comment('EN ID: '.$object['id'].' Img: '.$url1); + $this->comment(Str::upper($locale).' ID: '.$translation['id'].' Img: '.$url2); + $this->comment('Image Similarity: '.$similarity); $this->newLine(2); } }