mirror of
https://koodu.h-i.works/projects/thebadspace
synced 2025-06-25 16:04:37 -05:00
Seperated silence and block counts
Actions taken against and instance of have been separted into their respective buckets so they can be display properly rather than simply grouped together and mislabled. This gives a better sense of the severity of response per instance.
This commit is contained in:
@ -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,
|
||||
'name' => $item['domain'],
|
||||
'url' => $item['domain'],
|
||||
'rating' => $item['severity'],
|
||||
'comment' => $item['comment'],
|
||||
'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,
|
||||
'name' => $item[0],
|
||||
'url' => $item[0],
|
||||
'rating' => $item[1],
|
||||
'comment' => $item[2],
|
||||
'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) {
|
||||
@ -150,16 +175,17 @@ class LocationController extends Controller
|
||||
$images = [];
|
||||
$rating = ($item['rating'] == 'defederate') ? 'suspend' : $item['rating'];
|
||||
$new = Location::create([
|
||||
'uuid' => Uuid::uuid4(),
|
||||
'name' => $item['url'],
|
||||
'url' => $item['url'],
|
||||
'description' => ($item['comment'] != null) ? $item['comment'] : "no description",
|
||||
'active' => true,
|
||||
'rating' => $rating,
|
||||
'added_by' => 1,
|
||||
'tags' => 'poor moderation, hate speech',
|
||||
'images' => json_encode($images),
|
||||
'block_count' => $item['count'],
|
||||
'uuid' => Uuid::uuid4(),
|
||||
'name' => $item['url'],
|
||||
'url' => $item['url'],
|
||||
'description' => ($item['comment'] != null) ? $item['comment'] : "no description",
|
||||
'active' => true,
|
||||
'rating' => $rating,
|
||||
'added_by' => 1,
|
||||
'tags' => 'poor moderation, hate speech',
|
||||
'images' => json_encode($images),
|
||||
'block_count' => $item['block_count'],
|
||||
'silence_count' => $item['silence_count'],
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user