Commit 0422a8e7 authored by Arnaud Bey's avatar Arnaud Bey
Browse files

fix #98

parent b0cd66aa
......@@ -74,8 +74,12 @@ class ActivityController extends Controller
public function addComboPointsAction(Round $round, $length)
{
$language = $round->getLanguage();
$comboPoints = $this->getDoctrine()->getRepository('MagicWordBundle:Rules\ComboPoints')->findOneBy(["length"=>$length, "language"=>$language]);
$this->get('mw_manager.activity')->addComboPoints($round, $comboPoints);
$points = $length;
if ($comboPoints = $this->getDoctrine()->getRepository('MagicWordBundle:Rules\ComboPoints')->findOneBy(["length"=>$length, "language"=>$language])) {
$points = $comboPoints->getPoints();
}
$this->get('mw_manager.activity')->addComboPoints($round, $points);
return new JsonResponse(['points' => $comboPoints->getPoints()]);
}
......
......@@ -100,11 +100,11 @@ class ActivityManager
$this->em->flush();
}
public function addComboPoints(Round $round, ComboPoints $comboPoints)
public function addComboPoints(Round $round, $points)
{
$activity = $this->getActivity($round);
$activity->setComboPoints($activity->getComboPoints() + $comboPoints->getPoints());
$activity->setComboPoints($activity->getComboPoints() + $points);
$this->em->persist($activity);
$this->em->flush();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment