Fix indexer:common - bad fingerprints creates new entries instead of updating

This commit is contained in:
Irfan 2021-07-19 16:03:43 +05:00
parent 3b5c93180f
commit 7676d7f846

View File

@ -71,7 +71,7 @@ class CommonIndexer extends Command
foreach ($results as $i => $item) {
$result = DB::table('producers')
->where('mal_id', $item['mal_id'])
->updateOrInsert(['request_hash'=>'request:producers:'.sha1($item['mal_id'].$item['name'].$item['count'])]+$item);
->updateOrInsert(['request_hash'=>'request:producers:'.sha1($item['mal_id'].$item['name'])]+$item);
echo "Indexing {$i}/{$itemCount} \r";
}
@ -98,7 +98,7 @@ class CommonIndexer extends Command
foreach ($results as $i => $item) {
$result = DB::table('magazines')
->where('mal_id', $item['mal_id'])
->updateOrInsert(['request_hash'=>'request:magazines:'.sha1($item['mal_id'].$item['name'].$item['count'])]+$item);
->updateOrInsert(['request_hash'=>'request:magazines:'.sha1($item['mal_id'].$item['name'])]+$item);
echo "Indexing {$i}/{$itemCount} \r";
}
@ -125,7 +125,7 @@ class CommonIndexer extends Command
foreach ($results as $i => $item) {
$result = DB::table('genres_anime')
->where('mal_id', $item['mal_id'])
->updateOrInsert(['request_hash'=>'request:anime_genres:'.sha1($item['mal_id'].$item['name'].$item['count'])]+$item);
->updateOrInsert(['request_hash'=>'request:anime_genres:'.sha1($item['mal_id'].$item['name'])]+$item);
echo "Indexing {$i}/{$itemCount} \r";
}
@ -152,7 +152,7 @@ class CommonIndexer extends Command
foreach ($results as $i => $item) {
$result = DB::table('genres_manga')
->where('mal_id', $item['mal_id'])
->updateOrInsert(['request_hash'=>'request:manga_genres:'.sha1($item['mal_id'].$item['name'].$item['count'])]+$item);
->updateOrInsert(['request_hash'=>'request:manga_genres:'.sha1($item['mal_id'].$item['name'])]+$item);
echo "Indexing {$i}/{$itemCount} \r";
}