| @@ 80-90 (lines=11) @@ | ||
| 77 | public function createAction(Player $me) |
|
| 78 | { |
|
| 79 | return $this->create($me, function (Match $match) use ($me) { |
|
| 80 | if ($me->canEdit($match) |
|
| 81 | && $match->isOfficial() |
|
| 82 | && (!$match->getTeamA()->isLastMatch($match) |
|
| 83 | || !$match->getTeamB()->isLastMatch($match)) |
|
| 84 | ) { |
|
| 85 | $url = Service::getGenerator()->generate('match_recalculate', array( |
|
| 86 | 'match' => $match->getId(), |
|
| 87 | )); |
|
| 88 | ||
| 89 | return new RedirectResponse($url); |
|
| 90 | } |
|
| 91 | }); |
|
| 92 | } |
|
| 93 | ||
| @@ 97-106 (lines=10) @@ | ||
| 94 | public function deleteAction(Player $me, Match $match) |
|
| 95 | { |
|
| 96 | return $this->delete($match, $me, function () use ($match, $me) { |
|
| 97 | if ($match->getTeamA()->isLastMatch($match) && $match->getTeamB()->isLastMatch($match)) { |
|
| 98 | $match->resetTeamElos(); |
|
| 99 | $match->resetPlayerElos(); |
|
| 100 | } elseif ($me->canEdit($match)) { |
|
| 101 | $url = Service::getGenerator()->generate('match_recalculate', array( |
|
| 102 | 'match' => $match->getId(), |
|
| 103 | )); |
|
| 104 | ||
| 105 | return new RedirectResponse($url); |
|
| 106 | } |
|
| 107 | }); |
|
| 108 | } |
|
| 109 | ||