Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2161 events not imported automatically #2165

Merged
merged 2 commits into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions app/Console/Commands/api/Baden.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class Baden extends Command
{

use GermanTraits;

/**
* The name and signature of the console command.
*
Expand Down Expand Up @@ -58,24 +59,18 @@ public function handle()
$url = "https://bw.codeweek.de/?tx_codeweekevents_api[action]=listForEu&tx_codeweekevents_api[controller]=Api&tx_codeweekevents_api[format]=.json&tx_typoscriptrendering[context]={%22record%22%3A%22pages_1%22%2C%22path%22%3A%22tt_content.list.20.codeweekevents_api%22}&cHash=74bb9d71d62e381ebe95b33c1e197943";
dump("Loading $city events");

$response = Http::get($url);

$json = $response->json();
$json = $this->loadJson($url);

if (is_null($json)){
if (is_null($json)) {
Log::info("!!! No data in feed from $city API:");
return 0;
}

$this->createRSSItem($json, $city);



return Artisan::call("import:baden");




}

public function getCustomTag($item, $tag)
Expand Down
6 changes: 2 additions & 4 deletions app/Console/Commands/api/Bayern.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,9 @@ public function handle()
dump("Loading $city events");
$force = $this->option('force');

$response = Http::get($url);
$json = $this->loadJson($url);

$json = $response->json();

if (is_null($json)){
if (is_null($json)) {
Log::info("!!! No data in feed from $city API:");
return 0;
}
Expand Down
6 changes: 2 additions & 4 deletions app/Console/Commands/api/Berlin.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,9 @@ public function handle()
dump("Loading $city events");
$force = $this->option('force');

$response = Http::get($url);
$json = $this->loadJson($url);

$json = $response->json();

if (is_null($json)){
if (is_null($json)) {
Log::info("!!! No data in feed from $city API:");
return 0;
}
Expand Down
6 changes: 2 additions & 4 deletions app/Console/Commands/api/Bonn.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,9 @@ public function handle()
$url = "https://bonn.codeweek.de/?tx_codeweekevents_api[action]=listForEu&tx_codeweekevents_api[controller]=Api&tx_codeweekevents_api[format]=.json&tx_typoscriptrendering[context]={%22record%22%3A%22pages_1%22%2C%22path%22%3A%22tt_content.list.20.codeweekevents_api%22}&cHash=74bb9d71d62e381ebe95b33c1e197943";
dump("Loading $city events");

$response = Http::get($url);
$json = $this->loadJson($url);

$json = $response->json();

if (is_null($json)){
if (is_null($json)) {
Log::info("!!! No data in feed from $city API:");
return 0;
}
Expand Down
6 changes: 2 additions & 4 deletions app/Console/Commands/api/Bremen.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,9 @@ public function handle()
$url = "https://bremen.codeweek.de/?tx_codeweekevents_api[action]=listForEu&tx_codeweekevents_api[controller]=Api&tx_codeweekevents_api[format]=.json&tx_typoscriptrendering[context]={%22record%22%3A%22pages_1%22%2C%22path%22%3A%22tt_content.list.20.codeweekevents_api%22}&cHash=74bb9d71d62e381ebe95b33c1e197943";
dump("Loading $city events");

$response = Http::get($url);
$json = $this->loadJson($url);

$json = $response->json();

if (is_null($json)){
if (is_null($json)) {
Log::info("!!! No data in feed from $city API:");
return 0;
}
Expand Down
6 changes: 2 additions & 4 deletions app/Console/Commands/api/Dresden.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,9 @@ public function handle()
$url = "https://dresden.codeweek.de/?tx_codeweekevents_api[action]=listForEu&tx_codeweekevents_api[controller]=Api&tx_codeweekevents_api[format]=.json&tx_typoscriptrendering[context]={%22record%22%3A%22pages_1%22%2C%22path%22%3A%22tt_content.list.20.codeweekevents_api%22}&cHash=74bb9d71d62e381ebe95b33c1e197943";
dump("Loading $city events");

$response = Http::get($url);
$json = $this->loadJson($url);

$json = $response->json();

if (is_null($json)){
if (is_null($json)) {
Log::info("!!! No data in feed from $city API:");
return 0;
}
Expand Down
10 changes: 8 additions & 2 deletions app/Console/Commands/api/GermanTraits.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@

trait GermanTraits
{

private function loadJson($url){
$client = new \GuzzleHttp\Client();
$guzzle = $client->request('get', $url);

return json_decode($guzzle->getBody(), true);
}
/**
* @param $json
*/
Expand All @@ -25,7 +32,6 @@ private function createRSSItem($json, $city): void
$className = '\App\RSSItems\\' . $city . 'RSSItem';
$RSSitem = new $className;


$RSSitem->uid = $item['uid'];
$RSSitem->title = $item['title'];
$RSSitem->description = $item['description'];
Expand All @@ -41,7 +47,7 @@ private function createRSSItem($json, $city): void
$RSSitem->user_publicEmail = $item['user']['publicEmail'];
$RSSitem->user_type = $item['user']['type']['identifier'] ?? '';
$RSSitem->user_website = $item['user']['www'];
$RSSitem->activity_type = $item['type']['identifier'];
$RSSitem->activity_type = $item['type']['identifier'] ?? 'invite-in-person';
$RSSitem->tags = trim(implode(";", Arr::pluck($item['tags'], 'title')));
$RSSitem->themes = trim(implode(",", Arr::pluck($item['themes'], 'identifier')));
$RSSitem->audience = trim(implode(",", Arr::pluck($item['audience'], 'identifier')));
Expand Down
6 changes: 2 additions & 4 deletions app/Console/Commands/api/Hamburg.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,9 @@ public function handle()
dump("Loading $city events");
$force = $this->option('force');

$response = Http::get($url);
$json = $this->loadJson($url);

$json = $response->json();

if (is_null($json)){
if (is_null($json)) {
Log::info("!!! No data in feed from $city API:");
return 0;
}
Expand Down
6 changes: 2 additions & 4 deletions app/Console/Commands/api/Leipzig.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,9 @@ public function handle()
dump("Loading $city events");
$force = $this->option('force');

$response = Http::get($url);
$json = $this->loadJson($url);

$json = $response->json();

if (is_null($json)){
if (is_null($json)) {
Log::info("!!! No data in feed from $city API:");
return 0;
}
Expand Down
6 changes: 3 additions & 3 deletions app/Console/Commands/api/Muensterland.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ public function handle()
$url = "https://muensterland.codeweek.de/?tx_codeweekevents_api[action]=listForEu&tx_codeweekevents_api[controller]=Api&tx_codeweekevents_api[format]=.json&tx_typoscriptrendering[context]={%22record%22%3A%22pages_1%22%2C%22path%22%3A%22tt_content.list.20.codeweekevents_api%22}&cHash=74bb9d71d62e381ebe95b33c1e197943";
dump("Loading $city events");

$response = Http::get($url);
$json = $this->loadJson($url);

$json = $response->json();

if (is_null($json)){

if (is_null($json)) {
Log::info("!!! No data in feed from $city API:");
return 0;
}
Expand Down
6 changes: 2 additions & 4 deletions app/Console/Commands/api/Nordhessen.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,9 @@ public function handle()
dump("Loading $city events");
$force = $this->option('force');

$response = Http::get($url);
$json = $this->loadJson($url);

$json = $response->json();

if (is_null($json)){
if (is_null($json)) {
Log::info("!!! No data in feed from $city API:");
return 0;
}
Expand Down
6 changes: 2 additions & 4 deletions app/Console/Commands/api/Thueringen.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,9 @@ public function handle()
dump("Loading $city events");
$force = $this->option('force');

$response = Http::get($url);
$json = $this->loadJson($url);

$json = $response->json();

if (is_null($json)){
if (is_null($json)) {
Log::info("!!! No data in feed from $city API:");
return 0;
}
Expand Down
3 changes: 2 additions & 1 deletion app/Helpers/ImporterHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ class ImporterHelper

public static function getGermanCities()
{
return ['hamburg', 'baden', 'bonn', 'berlin', 'leipzig', 'dresden', 'thueringen', 'bremen', 'muensterland', 'nordhessen', 'bayern'];
// return ['hamburg', 'baden', 'bonn', 'berlin', 'leipzig', 'dresden', 'thueringen', 'bremen', 'muensterland', 'nordhessen', 'bayern'];
return ['hamburg', 'baden', 'bonn', 'berlin', 'leipzig', 'thueringen', 'bremen', 'muensterland', 'nordhessen', 'bayern'];
}

//Create or load Technical user based on username
Expand Down
Loading