@ -72,14 +72,26 @@ class LocationController extends Controller
$index = array_search($item['domain'], array_column($unified, 'url'));
if ($index) {
//if there is a match, update the count
++$unified[$index]['count'];
if ($item['severity'] == "suspend" || $item['severity'] == "defederate") {
++$unified[$index]['block_count'];
} else {
++$unified[$index]['silence_count'];
}
} else {
$silence = 0;
$suspend = 0;
if ($item['severity'] == "suspend" || $item['severity'] == "defederate") {
++$silence;
} else {
++$suspend;
}
array_push($unified, [
'name' => $item['domain'],
'url' => $item['domain'],
'rating' => $item['severity'],
'comment' => $item['comment'],
'count' => 1,
'block_count' => $suspend,
'silence_count' => $silence,
]);
}
}
@ -91,14 +103,26 @@ class LocationController extends Controller
$index = array_search($item[0], array_column($unified, 'url'));
if ($index) {
//if there is a match, update the count
++$unified[$index]['count'];
if ($item[1] == "suspend" || $item['severity'] == "defederate") {
++$unified[$index]['block_count'];
} else {
++$unified[$index]['silence_count'];
}
} else {
$silence = 0;
$suspend = 0;
if ($item[1] == "suspend" || $item[1] == "defederate") {
++$silence;
} else {
++$suspend;
}
array_push($unified, [
'name' => $item[0],
'url' => $item[0],
'rating' => $item[1],
'comment' => $item[2],
'count' => 1,
'block_count' => $suspend,
'silence_count' => $silence,
]);
}
}
@ -137,7 +161,8 @@ class LocationController extends Controller
++$duplicates;
//update block count for existing item
$location->block_count = $item['count'];
$location->block_count = $item['block_count'];
$location->silence_count = $item['silence_count'];
//replace null with empty array
if ($location->images == null) {
@ -159,7 +184,8 @@ class LocationController extends Controller
'added_by' => 1,
'tags' => 'poor moderation, hate speech',
'images' => json_encode($images),
'block_count' => $item['count'],
'block_count' => $item['block_count'],
'silence_count' => $item['silence_count'],
]);
}
}