Skip to content

Commit

Permalink
Merge pull request #2174 from codeeu/2169-bulk-upload-for-codeweek-fo…
Browse files Browse the repository at this point in the history
…r-uk

DigitAll 2023
  • Loading branch information
alainvd authored Oct 17, 2023
2 parents 710141d + 2654652 commit f91adfe
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion app/Console/Commands/excel/UKDigitallCharity.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function handle() {

Excel::import(
new UKDigitAllCharityEventsImport(),
'uk-digitall-charity.xlsx',
'digitall-2023.xlsx',
'excel'
);
}
Expand Down
4 changes: 2 additions & 2 deletions app/Imports/UKDigitAllCharityEventsImport.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function parseDate($date){
*/
public function model(array $row) {
// dd($this->parseDate($row['start_date']));
// dd($row);

$event = new Event([
'status' => 'APPROVED',
'title' => $row['activity_title'],
Expand All @@ -52,7 +52,7 @@ public function model(array $row) {
'pub_date' => now(),
'created' => now(),
'updated' => now(),
'codeweek_for_all_participation_code' => 'cw22-DigitAll',
'codeweek_for_all_participation_code' => 'cw23-DigitAll',
'start_date' => $this->parseDate($row['start_date']),
'end_date' => $this->parseDate($row['end_date']),
'geoposition' => $row['latitude'] . ',' . $row['longitude'],
Expand Down
12 changes: 5 additions & 7 deletions app/Imports/UKDigitAllEventsImport.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ public function parseDate($date){
* @return \Illuminate\Database\Eloquent\Model|null
*/
public function model(array $row) {
// dd($this->parseDate($row['start_date']));
// dd($row);
$event = new Event([
'status' => 'APPROVED',
'title' => $row['activity_title'],
Expand Down Expand Up @@ -68,11 +66,11 @@ public function model(array $row) {
->audiences()
->attach(explode(',', $row['audience_comma_separated_ids']));
}
// if ($row['theme_comma_separated_ids']) {
// $event
// ->themes()
// ->attach(explode(',', $row['theme_comma_separated_ids']));
// }
if ($row['theme_comma_separated_ids']) {
$event
->themes()
->attach(explode(',', $row['theme_comma_separated_ids']));
}

Log::info($event->slug);
return $event;
Expand Down
Binary file added resources/excel/digitall-2023.xlsx
Binary file not shown.

0 comments on commit f91adfe

Please sign in to comment.