Add "best rated games" category
authorChristian Weiske <cweiske@cweiske.de>
Sun, 18 Jul 2021 18:46:15 +0000 (20:46 +0200)
committerChristian Weiske <cweiske@cweiske.de>
Sun, 18 Jul 2021 18:46:15 +0000 (20:46 +0200)
bin/filters.php
bin/import-game-data.php

index 9cac07a2e613e64e0e71cd69637cc64bd923e8f0..f899be01fa58282307faf57a22c3bdf6163e68d4 100644 (file)
@@ -117,6 +117,14 @@ function filterBestRated($origGames, $limit)
     return array_slice($games, 0, $limit);
 }
 
+function filterBestRatedGames($origGames, $limit)
+{
+    $noApps = filterByGenre($origGames, 'App', true);
+    $noAppsNoEmus = filterByGenre($noApps, 'Emulator', true);
+
+    return filterBestRated($noAppsNoEmus, $limit);
+}
+
 function filterMostDownloaded($origGames, $limit)
 {
     $games = array_values($origGames);
index d98dd3f3eb5388ba2554f07c94209ceff9f62337..2685b3ffbc4da325652235a93002f48eda0733e0 100755 (executable)
@@ -175,8 +175,8 @@ function buildDiscover(array $games)
         filterLastAdded($games, 10)
     );
     addDiscoverRow(
-        $data, 'Best rated',
-        filterBestRated($games, 10),
+        $data, 'Best rated games',
+        filterBestRatedGames($games, 10),
         true
     );
 
@@ -191,6 +191,7 @@ function buildDiscover(array $games)
         $data, 'Special',
         [
             'Best rated',
+            'Best rated games',
             'Most rated',
             'Random',
             'Last updated',
@@ -200,6 +201,10 @@ function buildDiscover(array $games)
         'api/v1/discover-data/' . categoryPath('Best rated') . '.json',
         buildSpecialCategory('Best rated', filterBestRated($games, 99))
     );
+    writeJson(
+        'api/v1/discover-data/' . categoryPath('Best rated games') . '.json',
+        buildSpecialCategory('Best rated games', filterBestRatedGames($games, 99))
+    );
     writeJson(
         'api/v1/discover-data/' . categoryPath('Most rated') . '.json',
         buildSpecialCategory('Most rated', filterMostDownloaded($games, 99))