Skip to content

Commit

Permalink
Merge pull request #159 from bcgov/programs-update-csv-2025Jan
Browse files Browse the repository at this point in the history
- Added scripts for updating/creating programs
  • Loading branch information
MaelCormier-CGI authored Jan 8, 2025
2 parents 1397920 + 152afd0 commit 20a5544
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
3 changes: 2 additions & 1 deletion app/Console/Commands/ImportNewPrograms.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ public function handle()
continue;
}

$program_graduate = ($record['Program_Type'] !== 'Undergraduate Programs');
// Determine if the program is a graduate program
$program_graduate = ($record['Program_Type'] === 'Graduate Programs') && ($record['Credential'] === 'Degree');

// Remove any hyphens that could be exist in the csv file provided
$guid = str_replace('-', '', $record['JM_Assigned_GUID']);
Expand Down
8 changes: 6 additions & 2 deletions app/Console/Commands/UpdateExistingPrograms.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,23 @@ public function handle()
continue;
}

$institution = Institution::where('guid', $record['Insitution GUID'])->first();
$institution = Institution::where('guid', $record['Institution_guid'])->first();

if (!$institution) {
$this->error("Institution not found: {$record['Insitution GUID']}");
$this->error("Institution not found: {$record['Institution_guid']}");
continue;
}

// Determine if the program is a graduate program
$program_graduate = ($record['Program_Type'] === 'Graduate Programs') && ($record['Credential'] === 'Degree');

$program->update([
'institution_guid' => $institution->guid,
'program_name' => $record['Program_Name'],
'cip_code' => $record['CIP_Code'],
'program_type' => $record['Program_Type'],
'credential' => $record['Credential'],
'program_graduate' => $program_graduate,
]);

$this->info("Program updated: {$record['Program_Name']}");
Expand Down

0 comments on commit 20a5544

Please sign in to comment.