"Best rated" and "Last updated" only for 20+ games categories
authorChristian Weiske <cweiske@cweiske.de>
Wed, 28 Jul 2021 15:45:43 +0000 (17:45 +0200)
committerChristian Weiske <cweiske@cweiske.de>
Wed, 28 Jul 2021 15:45:43 +0000 (17:45 +0200)
bin/import-game-data.php

index ee6c1d971b8d835e1f025eb35add345ca3a17140..5ee582e9501c18220fa8913f437691ab6f06ea30 100755 (executable)
@@ -290,15 +290,18 @@ function buildDiscoverCategory($name, $games)
         'rows'  => [],
         'tiles' => [],
     ];
-    addDiscoverRow(
-        $data, 'Last Updated',
-        filterLastUpdated($games, 10)
-    );
-    addDiscoverRow(
-        $data, 'Best rated',
-        filterBestRated($games, 10),
-        true
-    );
+
+    if (count($games) >= 20) {
+        addDiscoverRow(
+            $data, 'Last Updated',
+            filterLastUpdated($games, 10)
+        );
+        addDiscoverRow(
+            $data, 'Best rated',
+            filterBestRated($games, 10),
+            true
+        );
+    }
 
     $games = sortByTitle($games);
     $chunks = array_chunk($games, 4);