Skip to content

Commit

Permalink
#454 - fix: code review fix
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilpiech97 committed Jul 1, 2024
1 parent 3cb88dc commit 8ccdeb9
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ public function handle(): void
})->get();

$usersOverdueMedicalExams = User::query()
->whereRelation("histories", function ($query): void {
->whereDoesntHave("histories", function ($query): void {
$query->where("type", UserHistoryType::MedicalExam)
->where("to", ">", Carbon::now());
})->withWhereHas("histories", function ($query): void {
$query->where("type", UserHistoryType::MedicalExam)
->where("to", "<", Carbon::now());
})->get();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ public function handle(): void
})->get();

$usersForOverdueOhsTraining = User::query()
->whereRelation("histories", function ($query): void {
->whereDoesntHave("histories", function ($query): void {
$query->where("type", UserHistoryType::OhsTraining)
->where("to", ">", Carbon::now());
})->withWhereHas("histories", function ($query): void {
$query->where("type", UserHistoryType::OhsTraining)
->where("to", "<", Carbon::now());
})->get();
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/UserHistoryController.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function index(User $user): Response
$this->authorize("manageUsers");

$history = $user->histories()
->orderBy("from", "desc")
->orderBy("to", "desc")
->get();

return inertia("UserHistory/Index", [
Expand Down
2 changes: 1 addition & 1 deletion resources/js/Pages/UserHistory/Edit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const form = useForm({
to: props.history.to,
comment: props.history.comment,
type: props.types.find(type => type.value === props.history.type),
employmentForm: props.employmentForms.find(employmentForm => employmentForm.value === props.history.employmentForm) ?? '',
employmentForm: props.employmentForms.find(employmentForm => employmentForm.value === props.history.employment_form) ?? '',
})
function updateForm() {
Expand Down

0 comments on commit 8ccdeb9

Please sign in to comment.