Skip to content
This repository has been archived by the owner on Feb 8, 2025. It is now read-only.

Commit

Permalink
fix: fix guess employee game (#639)
Browse files Browse the repository at this point in the history
  • Loading branch information
djaiss authored Mar 20, 2021
1 parent b9d437b commit c685c79
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,24 +85,25 @@ private function createNewGame(): void
->inRandomOrder()
->first();

$allEmployees = $this->employee->company->employees()
$twoOtherEmployees = $this->employee->company->employees()
->where('locked', false)
->where('id', '!=', $employeeToFind->id)
->where('id', '!=', $this->employee->id)
->where('pronoun_id', $employeeToFind->pronoun_id)
->select('id', 'first_name', 'last_name')
->inRandomOrder()
->take(2)
->get();

if ($allEmployees->count() != 2) {
if ($twoOtherEmployees->count() != 2) {
throw new OutOfRangeException();
}

$this->game = GuessEmployeeGame::create([
'employee_who_played_id' => $this->employee->id,
'employee_to_find_id' => $employeeToFind->id,
'first_other_employee_to_find_id' => $allEmployees->get(0)->id,
'second_other_employee_to_find_id' => $allEmployees->get(1)->id,
'first_other_employee_to_find_id' => $twoOtherEmployees->get(0)->id,
'second_other_employee_to_find_id' => $twoOtherEmployees->get(1)->id,
'played' => false,
'found' => false,
]);
Expand Down
4 changes: 2 additions & 2 deletions resources/js/Pages/Company/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@
<new-hires :hires="newHiresThisWeek" />

<recent-skills :skills="latestSkills" />

<recent-ships :ships="latestShips" />
</div>

<div class="fl w-third-l w-100 pl4-l">
<teams :teams="teams" :statistics="statistics" />

<recent-ships :ships="latestShips" />
</div>
</div>
</div>
Expand Down

0 comments on commit c685c79

Please sign in to comment.