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 07a00bb3a778482e09b1a72f3acf5db6635d19b1..703114a2410fa9e65f88aec8d3c2e499379fa9a8 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 cf6a047640861478b3758f4ac65b92bacd8afef8..2d0076e13af2f70a0bfde9fb9f5412a6e60d2b1f 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 = [];