Skip to content

Commit

Permalink
Merge pull request #1128 from proditis/fix-hints-for-both
Browse files Browse the repository at this point in the history
fix hints when player type is `both`
  • Loading branch information
proditis authored Mar 19, 2024
2 parents ba66d2f + 34ca641 commit 1583647
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion backend/modules/gameplay/controllers/HintController.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,18 @@ public function actionGive($id)
// {
// // fetch player_question
// }
$db->createCommand('INSERT INTO player_hint (player_id, hint_id) SELECT id,:hint_id FROM player WHERE active=1 and `type`=:ptype ON DUPLICATE KEY UPDATE player_id=values(player_id)')
if($hint->player_type==='both')
{
foreach(['offense','defense'] as $val)
{
$db->createCommand('INSERT INTO player_hint (player_id, hint_id) SELECT id,:hint_id FROM player WHERE active=1 and `type`=:ptype ON DUPLICATE KEY UPDATE player_id=values(player_id)')
->bindValue(':hint_id', $hint->id)
->bindValue(':ptype', $val)
->execute();
}
}
else
$db->createCommand('INSERT INTO player_hint (player_id, hint_id) SELECT id,:hint_id FROM player WHERE active=1 and `type`=:ptype ON DUPLICATE KEY UPDATE player_id=values(player_id)')
->bindValue(':hint_id', $hint->id)
->bindValue(':ptype', $hint->player_type)
->execute();
Expand Down

0 comments on commit 1583647

Please sign in to comment.