do not show "Make" apps in discover
authorChristian Weiske <cweiske@cweiske.de>
Tue, 14 Jan 2020 19:20:09 +0000 (20:20 +0100)
committerChristian Weiske <cweiske@cweiske.de>
Tue, 14 Jan 2020 19:20:09 +0000 (20:20 +0100)
bin/filters.php
bin/import-game-data.php

index 07a00bb..703114a 100644 (file)
@@ -10,12 +10,18 @@ function filterByAge($origGames, $age)
     return $filtered;
 }
 
-function filterByGenre($origGames, $genre)
+function filterByGenre($origGames, $genre, $remove = false)
 {
     $filtered = [];
     foreach ($origGames as $game) {
-        if (array_search($genre, $game->genres) !== false) {
-            $filtered[] = $game;
+        if ($remove) {
+            if (array_search($genre, $game->genres) === false) {
+                $filtered[] = $game;
+            }
+        } else {
+            if (array_search($genre, $game->genres) !== false) {
+                $filtered[] = $game;
+            }
         }
     }
     return $filtered;
index cf6a047..2d0076e 100755 (executable)
@@ -77,14 +77,6 @@ foreach ($gameFiles as $gameFile) {
         'api/v1/games/' . $game->packageName . '/purchases',
         buildPurchases($game)
     );
-    /**/
-
-    /* this crashes babylonian twins
-    writeJson(
-        'api/v1/games/' . $game->packageName . '/purchases',
-        "{}\n"
-    );
-    */
 
     writeJson(
         'api/v1/apps/' . $game->packageName . '.json',
@@ -134,6 +126,7 @@ writeJson(
 
 function buildDiscover(array $games)
 {
+    $games = removeMakeGames($games);
     $data = [
         'title' => 'DISCOVER',
         'rows'  => [],
@@ -774,6 +767,11 @@ function getPromotedProduct($game)
     return null;
 }
 
+function removeMakeGames(array $games)
+{
+    return filterByGenre($games, 'Tutorials', true);
+}
+
 function removeMakeGenres($genres)
 {
     $filtered = [];