From 292f053b1a02af364fa90deee2a073175f703d7c Mon Sep 17 00:00:00 2001 From: Alain Van Driessche Date: Wed, 15 Nov 2023 11:30:51 +0100 Subject: [PATCH 1/2] Mass added for --- app/Console/Commands/api/GermanTraits.php | 3 +- app/Event.php | 3 +- app/Importers/Eeducation.php | 3 +- ...4_100000_add_submission_type_to_events.php | 36 +++++++++++++++++++ 4 files changed, 42 insertions(+), 3 deletions(-) create mode 100644 database/migrations/2023_11_14_100000_add_submission_type_to_events.php diff --git a/app/Console/Commands/api/GermanTraits.php b/app/Console/Commands/api/GermanTraits.php index 3cf6862c7..c8a26b0b5 100644 --- a/app/Console/Commands/api/GermanTraits.php +++ b/app/Console/Commands/api/GermanTraits.php @@ -115,7 +115,8 @@ private function createGermanEvent($city): void "pub_date" => now(), "created" => now(), "updated" => now(), - "codeweek_for_all_participation_code" => "cw22-$city", + "codeweek_for_all_participation_code" => "cw23-$city", + "mass_added_for" => "codeweek_de_api", "start_date" => $this->eventStartDate, "end_date" => $this->eventEndDate, "longitude" => $this->longitude, diff --git a/app/Event.php b/app/Event.php index e2e1454e9..be9c5bcb7 100644 --- a/app/Event.php +++ b/app/Event.php @@ -63,7 +63,8 @@ class Event extends Model 'picture_detail', 'language', 'location_id', - 'leading_teacher_tag' + 'leading_teacher_tag', + 'mass_added_for' ]; protected $casts = [ diff --git a/app/Importers/Eeducation.php b/app/Importers/Eeducation.php index 16ea14fe9..6643366e8 100644 --- a/app/Importers/Eeducation.php +++ b/app/Importers/Eeducation.php @@ -64,7 +64,8 @@ public function parse() "end_date" => Carbon::parse($this->remote->enddate)->toDateTimeString(), "geoposition" => $this->remote->lat . "," . $this->remote->lng, "longitude" => $this->remote->lng, - "latitude" => $this->remote->lat + "latitude" => $this->remote->lat, + "mass_added_for" => "Eeducation" ]); $event->save(); diff --git a/database/migrations/2023_11_14_100000_add_submission_type_to_events.php b/database/migrations/2023_11_14_100000_add_submission_type_to_events.php new file mode 100644 index 000000000..5e901d97e --- /dev/null +++ b/database/migrations/2023_11_14_100000_add_submission_type_to_events.php @@ -0,0 +1,36 @@ +string('mass_added_for')->nullable()->index(); + }); + } + + + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + + Schema::table('events', function (Blueprint $table) + { + $table->dropColumn('mass_added_for'); + }); + } +} From c843fa36150bedba12c490428d5521da23f52692 Mon Sep 17 00:00:00 2001 From: Alain Van Driessche Date: Wed, 15 Nov 2023 13:10:21 +0100 Subject: [PATCH 2/2] Mass added for --- app/Console/Commands/api/GermanTraits.php | 2 +- app/Importers/Eeducation.php | 2 +- app/Imports/AppleEventsImport.php | 3 ++- app/Imports/BulgariaEventsImport.php | 3 ++- app/Imports/CoderDojoEventsImport.php | 3 ++- app/Imports/DutchDanceEventsImport.php | 3 ++- app/Imports/DutchMoorlagEventsImport.php | 3 ++- app/Imports/DutchSimoneEventsImport.php | 3 ++- app/Imports/EventsImport.php | 3 ++- app/Imports/GenericEventsImport.php | 1 + app/Imports/HamburgEventsImport.php | 3 ++- app/Imports/IrelandEventsImport.php | 3 ++- app/Imports/LuxembourgEventsImport.php | 3 ++- app/Imports/MagentaEventsImport.php | 1 + app/Imports/ReportedEventsImport.php | 1 + app/Imports/TelerikEventsImport.php | 3 ++- app/Imports/UKDigitAllCharityEventsImport.php | 3 ++- app/Imports/UKDigitAllEventsImport.php | 3 ++- app/MeetAndCodeRSSItem.php | 3 ++- 19 files changed, 33 insertions(+), 16 deletions(-) diff --git a/app/Console/Commands/api/GermanTraits.php b/app/Console/Commands/api/GermanTraits.php index c8a26b0b5..ff73ab7b4 100644 --- a/app/Console/Commands/api/GermanTraits.php +++ b/app/Console/Commands/api/GermanTraits.php @@ -116,7 +116,7 @@ private function createGermanEvent($city): void "created" => now(), "updated" => now(), "codeweek_for_all_participation_code" => "cw23-$city", - "mass_added_for" => "codeweek_de_api", + "mass_added_for" => "API codeweek_de", "start_date" => $this->eventStartDate, "end_date" => $this->eventEndDate, "longitude" => $this->longitude, diff --git a/app/Importers/Eeducation.php b/app/Importers/Eeducation.php index 6643366e8..fa2f782e0 100644 --- a/app/Importers/Eeducation.php +++ b/app/Importers/Eeducation.php @@ -65,7 +65,7 @@ public function parse() "geoposition" => $this->remote->lat . "," . $this->remote->lng, "longitude" => $this->remote->lng, "latitude" => $this->remote->lat, - "mass_added_for" => "Eeducation" + "mass_added_for" => "RSS Eeducation" ]); $event->save(); diff --git a/app/Imports/AppleEventsImport.php b/app/Imports/AppleEventsImport.php index bc673f431..02f834d3e 100644 --- a/app/Imports/AppleEventsImport.php +++ b/app/Imports/AppleEventsImport.php @@ -54,7 +54,8 @@ public function model(array $row) "geoposition" => $row["latitude"] . "," . $row["longitude"], "longitude" => $row["longitude"], "latitude" => $row["latitude"], - 'language' => strtolower(explode("_", $row['language'])[0]) + 'language' => strtolower(explode("_", $row['language'])[0]), + 'mass_added_for' => "Excel" ]); $event->save(); diff --git a/app/Imports/BulgariaEventsImport.php b/app/Imports/BulgariaEventsImport.php index 061e5e42f..e6f9caceb 100644 --- a/app/Imports/BulgariaEventsImport.php +++ b/app/Imports/BulgariaEventsImport.php @@ -51,7 +51,8 @@ public function model(array $row) "end_date" => $this->parseDate($row['end_date']), "geoposition" => $row["latitude"] . "," . $row["longitude"], "longitude" => $row["longitude"], - "latitude" => $row["latitude"] + "latitude" => $row["latitude"], + 'mass_added_for' => "Excel" ]); $event->save(); diff --git a/app/Imports/CoderDojoEventsImport.php b/app/Imports/CoderDojoEventsImport.php index c97cecaf7..7d162aa1a 100644 --- a/app/Imports/CoderDojoEventsImport.php +++ b/app/Imports/CoderDojoEventsImport.php @@ -60,7 +60,8 @@ public function model(array $row) "longitude" => $row["longitude"], "latitude" => $row["latitude"], "language"=> "nl", - "approved_by"=>19588 + "approved_by"=>19588, + 'mass_added_for' => "Excel" ]); $event->save(); diff --git a/app/Imports/DutchDanceEventsImport.php b/app/Imports/DutchDanceEventsImport.php index b12205a7a..6964e41dd 100644 --- a/app/Imports/DutchDanceEventsImport.php +++ b/app/Imports/DutchDanceEventsImport.php @@ -71,7 +71,8 @@ public function model(array $row) { 'geoposition' => $row['longitude'] . ',' . $row['latitude'], 'longitude' => $row['latitude'], 'latitude' => $row['longitude'], - 'language' => strtolower($row['language']) + 'language' => strtolower($row['language']), + 'mass_added_for' => "Excel" ]); $event->save(); diff --git a/app/Imports/DutchMoorlagEventsImport.php b/app/Imports/DutchMoorlagEventsImport.php index 9ba921a3a..4952a3e07 100644 --- a/app/Imports/DutchMoorlagEventsImport.php +++ b/app/Imports/DutchMoorlagEventsImport.php @@ -58,7 +58,8 @@ public function model(array $row) { 'geoposition' => $row['longitude'] . ',' . $row['latitude'], 'longitude' => $row['latitude'], 'latitude' => $row['longitude'], - 'language' => strtolower($row['language']) + 'language' => strtolower($row['language']), + 'mass_added_for' => "Excel" ]); $event->save(); diff --git a/app/Imports/DutchSimoneEventsImport.php b/app/Imports/DutchSimoneEventsImport.php index af0148456..f8a5b0c0e 100644 --- a/app/Imports/DutchSimoneEventsImport.php +++ b/app/Imports/DutchSimoneEventsImport.php @@ -58,7 +58,8 @@ public function model(array $row) { 'geoposition' => $row['latitude'] . ',' . $row['longitude'], 'longitude' => $row['longitude'], 'latitude' => $row['latitude'], - 'language' => strtolower($row['language']) + 'language' => strtolower($row['language']), + 'mass_added_for' => "Excel" ]); $event->save(); diff --git a/app/Imports/EventsImport.php b/app/Imports/EventsImport.php index 684a3c4cd..5c701b336 100644 --- a/app/Imports/EventsImport.php +++ b/app/Imports/EventsImport.php @@ -59,7 +59,8 @@ public function model(array $row) "end_date" => Carbon::parse($this->parseDate($row["end_date"]))->toDateTimeString(), "geoposition" => $row["latitude"] . "," . $row["longitude"], "longitude" => $row["longitude"], - "latitude" => $row["latitude"] + "latitude" => $row["latitude"], + 'mass_added_for' => "Excel" ]); diff --git a/app/Imports/GenericEventsImport.php b/app/Imports/GenericEventsImport.php index ba955ab4f..4e504c973 100644 --- a/app/Imports/GenericEventsImport.php +++ b/app/Imports/GenericEventsImport.php @@ -70,6 +70,7 @@ public function model(array $row) { 'longitude' => $row['longitude'], 'latitude' => $row['latitude'], 'language' => strtolower($row['language']), + 'mass_added_for' => "Excel" ]); $event->save(); diff --git a/app/Imports/HamburgEventsImport.php b/app/Imports/HamburgEventsImport.php index 59df28d2f..1b7114627 100644 --- a/app/Imports/HamburgEventsImport.php +++ b/app/Imports/HamburgEventsImport.php @@ -56,7 +56,8 @@ public function model(array $row) "end_date" => $this->parseDate($row['end_date']), "geoposition" => $row["latitude"] . "," . $row["longitude"], "longitude" => $row["longitude"], - "latitude" => $row["latitude"] + "latitude" => $row["latitude"], + 'mass_added_for' => "Excel" ]); $event->save(); diff --git a/app/Imports/IrelandEventsImport.php b/app/Imports/IrelandEventsImport.php index f89d927bc..62e7f1c8d 100644 --- a/app/Imports/IrelandEventsImport.php +++ b/app/Imports/IrelandEventsImport.php @@ -77,7 +77,8 @@ public function model(array $row) { 'geoposition' => $row['latitude'] . ',' . $row['longitude'], 'longitude' => str_replace(',','.',$row['longitude']), 'latitude' => str_replace(',','.',$row['latitude']), - 'language' => 'en' + 'language' => 'en', + 'mass_added_for' => "Excel" ]); $event->save(); diff --git a/app/Imports/LuxembourgEventsImport.php b/app/Imports/LuxembourgEventsImport.php index d34e43656..2abd478ac 100644 --- a/app/Imports/LuxembourgEventsImport.php +++ b/app/Imports/LuxembourgEventsImport.php @@ -53,7 +53,8 @@ public function model(array $row) { 'geoposition' => $row['latitude'] . ',' . $row['longitude'], 'longitude' => $row['longitude'], 'latitude' => $row['latitude'], - 'language' => strtolower($row['language']) + 'language' => strtolower($row['language']), + 'mass_added_for' => "Excel" ]); $event->save(); diff --git a/app/Imports/MagentaEventsImport.php b/app/Imports/MagentaEventsImport.php index 0cd993533..288d369ca 100644 --- a/app/Imports/MagentaEventsImport.php +++ b/app/Imports/MagentaEventsImport.php @@ -55,6 +55,7 @@ public function model(array $row) "longitude" => $row["longitude"], "latitude" => $row["latitude"], "language" => strtolower($row["language"]), + 'mass_added_for' => "Excel" ]); $event->save(); diff --git a/app/Imports/ReportedEventsImport.php b/app/Imports/ReportedEventsImport.php index c8d6e94c5..7777f000d 100644 --- a/app/Imports/ReportedEventsImport.php +++ b/app/Imports/ReportedEventsImport.php @@ -73,6 +73,7 @@ public function model(array $row) { 'participants_count' => 30, 'average_participant_age' => 10, 'percentage_of_females' => 50, + 'mass_added_for' => "Excel" ]); $event->save(); diff --git a/app/Imports/TelerikEventsImport.php b/app/Imports/TelerikEventsImport.php index 528a79988..a2fa4ded6 100644 --- a/app/Imports/TelerikEventsImport.php +++ b/app/Imports/TelerikEventsImport.php @@ -51,7 +51,8 @@ public function model(array $row) "end_date" => $this->parseDate($row['end_date']), "geoposition" => $row["latitude"] . "," . $row["longitude"], "longitude" => $row["longitude"], - "latitude" => $row["latitude"] + "latitude" => $row["latitude"], + 'mass_added_for' => "Excel" ]); $event->save(); diff --git a/app/Imports/UKDigitAllCharityEventsImport.php b/app/Imports/UKDigitAllCharityEventsImport.php index 06f7760ae..50fcb7e8c 100644 --- a/app/Imports/UKDigitAllCharityEventsImport.php +++ b/app/Imports/UKDigitAllCharityEventsImport.php @@ -58,7 +58,8 @@ public function model(array $row) { 'geoposition' => $row['latitude'] . ',' . $row['longitude'], 'longitude' => $row['longitude'], 'latitude' => $row['latitude'], - 'language' => strtolower($row['language']) + 'language' => strtolower($row['language']), + 'mass_added_for' => "Excel" ]); $event->save(); diff --git a/app/Imports/UKDigitAllEventsImport.php b/app/Imports/UKDigitAllEventsImport.php index d6d0c5afc..d941fd71c 100644 --- a/app/Imports/UKDigitAllEventsImport.php +++ b/app/Imports/UKDigitAllEventsImport.php @@ -56,7 +56,8 @@ public function model(array $row) { 'geoposition' => $row['latitude'] . ',' . $row['longitude'], 'longitude' => $row['longitude'], 'latitude' => $row['latitude'], - 'language' => strtolower($row['language']) + 'language' => strtolower($row['language']), + 'mass_added_for' => "Excel" ]); $event->save(); diff --git a/app/MeetAndCodeRSSItem.php b/app/MeetAndCodeRSSItem.php index a2972e770..d2d30dfda 100644 --- a/app/MeetAndCodeRSSItem.php +++ b/app/MeetAndCodeRSSItem.php @@ -128,7 +128,8 @@ public function createEvent($user) "longitude" => $this->lon, "latitude" => $this->lat, "geoposition" => $this->lat . "," . $this->lon, - "language" => MeetAndCodeHelper::getLanguage($this->link) + "language" => MeetAndCodeHelper::getLanguage($this->link), + 'mass_added_for' => "RSS meet_and_code" ]); $event->save();