Skip to content

Commit

Permalink
Bugs Fixed in Assessment Deletion.
Browse files Browse the repository at this point in the history
- Only deletes assessment and relevant enrollments.
  • Loading branch information
hpmouton committed Oct 28, 2024
1 parent a4a0731 commit 015d3f6
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 13 deletions.
5 changes: 0 additions & 5 deletions app/Models/Audit/assessment.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ class assessment extends Model

protected $guarded = [];

public function jcp()
{
return $this->hasMany(jcp::class, 'assessment_id');

}

public function enrolled()
{
Expand Down
4 changes: 0 additions & 4 deletions app/Models/Audit/jcp.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ public function employee()
return $this->belongsTo(User::class, 'user_id');
}

public function assessment()
{
return $this->belongsTo(assessment::class, 'assessment_id');
}

public function skills()
{
Expand Down
2 changes: 0 additions & 2 deletions database/factories/Audit/jcpFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,10 @@ class jcpFactory extends Factory
*/
public function definition(): array
{
$assessment_ids = \App\Models\Audit\assessment::select('id')->get();
$user_ids = \App\Models\User::select('id')->get();

return [
//This populates the jcp model fields
'assessment_id' => $this->faker->randomElement($assessment_ids),
'user_id' => $this->faker->unique()->randomElement($user_ids),
'position_title' => $this->faker->jobTitle(),
'job_grade' => $this->faker->numerify('B-#'),
Expand Down
2 changes: 0 additions & 2 deletions database/migrations/2024_03_22_094647_create_jcps_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ public function up(): void
{
Schema::create('jcps', function (Blueprint $table) {
$table->id();
$table->foreignId('assessment_id')->constrained()->cascadeOnDelete();
$table->foreignId('user_id')->constrained()->cascadeOnDelete();

$table->string('position_title');
Expand All @@ -23,7 +22,6 @@ public function up(): void
$table->integer('is_active')->default(1);

// Add a unique constraint
$table->unique(['user_id', 'assessment_id']);

$table->timestamps();
});
Expand Down

0 comments on commit 015d3f6

Please sign in to comment.