| @@ 603-614 (lines=12) @@ | ||
| 600 | * |
|
| 601 | * @return Array of PlaygroundGame\Entity\Game |
|
| 602 | */ |
|
| 603 | public function getPrizeCategoryGames($categoryid) |
|
| 604 | { |
|
| 605 | $em = $this->serviceLocator->get('doctrine.entitymanager.orm_default'); |
|
| 606 | ||
| 607 | $query = $em->createQuery('SELECT g FROM PlaygroundGame\Entity\Game g |
|
| 608 | WHERE (g.prizeCategory = :categoryid AND g.broadcastPlatform = 1) |
|
| 609 | ORDER BY g.publicationDate DESC'); |
|
| 610 | $query->setParameter('categoryid', $categoryid); |
|
| 611 | $games = $query->getResult(); |
|
| 612 | ||
| 613 | return $games; |
|
| 614 | } |
|
| 615 | ||
| 616 | public function checkGame($identifier, $checkIfStarted = true) |
|
| 617 | { |
|
| @@ 429-443 (lines=15) @@ | ||
| 426 | return $quiz; |
|
| 427 | } |
|
| 428 | ||
| 429 | public function getNumberCorrectAnswersQuiz($user, $count = 'count') |
|
| 430 | { |
|
| 431 | $em = $this->serviceLocator->get('doctrine.entitymanager.orm_default'); |
|
| 432 | ||
| 433 | $query = $em->createQuery( |
|
| 434 | "SELECT COUNT(e.id) FROM PlaygroundGame\Entity\Entry e, PlaygroundGame\Entity\Game g |
|
| 435 | WHERE e.user = :user |
|
| 436 | AND g.classType = 'quiz' |
|
| 437 | AND e.points > 0" |
|
| 438 | ); |
|
| 439 | $query->setParameter('user', $user); |
|
| 440 | $number = $query->getSingleScalarResult(); |
|
| 441 | ||
| 442 | return $number; |
|
| 443 | } |
|
| 444 | ||
| 445 | public function createQuizReply($data, $game, $user) |
|
| 446 | { |
|