<commit_before><?php

namespace UserBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Component\HttpFoundation\Request;
use UserBundle\Entity\Points;
use UserBundle\Entity\PointsGiven;
use UserBundle\Entity\PointsLog;
use UserBundle\Entity\PointsReceived;
use UserBundle\Entity\PointsReceivedAchievement;
use UserBundle\Entity\PointsReceivedPending;
use UserBundle\Entity\User;

class DashboardController extends Controller
{
    public function indexAction()
    {
        return $this->render('UserBundle:Dashboard:profile.html.twig');
    }
	
	public function scrumdashboardAction()
    {
		
        return $this->render('UserBundle:Dashboard:scrumdashboard.html.twig');
    }
	
	public function sendpointsAction(Request $request)
	{
		$post = $request->request->all();
		$em = $this->getDoctrine()->getManager();
		$searchUser = $this->searchUserByEmail($post['user']);
		$user = new User();
		$pointsGiven = new PointsGiven();
		$pointsLog = new PointsLog();
		$pointsReceived = new PointsReceived();
		
		$pointsGiven->setUserIdTo($searchUser->getId());
		$pointsGiven->setPoints($post['points']);
		$pointsGiven->setMessage($post['message']);
		$user->addPointsGiven($pointsGiven);
		$em->persist($pointsGiven);
		$em->flush();
		
		$currentUser = $this->get('security.token_storage')->getToken()->getUser();
		$pointsReceived->setUserIdFrom($currentUser->getId());
		$pointsReceived->setPoints($post['points']);
		$pointsReceived->setMessage($post['message']);
		$searchUser->addPointsReceived($pointsReceived);
		$em->persist($pointsReceived);
		$em->flush();
		
		//to do: decrease points of user that sent points
		
		return $this->render('UserBundle:Dashboard:profile.html.twig');
		// $pointsLog->
	}
	
	public function searchUserByEmail($email)
	{
		$repository = $this->getDoctrine()->getRepository('UserBundle:User');
		$user = $repository->findOneBy(
			array('email' => $email)
		);
		
		return $user;
	}
}
<commit_msg>to do: decrease points of user that sent points<commit_after><?php

namespace UserBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Component\HttpFoundation\Request;
use UserBundle\Entity\Points;
use UserBundle\Entity\PointsGiven;
use UserBundle\Entity\PointsLog;
use UserBundle\Entity\PointsReceived;
use UserBundle\Entity\PointsReceivedAchievement;
use UserBundle\Entity\PointsReceivedPending;
use UserBundle\Entity\User;

class DashboardController extends Controller
{
    public function indexAction()
    {
        return $this->render('UserBundle:Dashboard:profile.html.twig');
    }
	
	public function scrumdashboardAction()
    {
		
        return $this->render('UserBundle:Dashboard:scrumdashboard.html.twig');
    }
	
	public function sendpointsAction(Request $request)
	{
		$post = $request->request->all();
		$em = $this->getDoctrine()->getManager();
		$searchUser = $this->searchUserByEmail($post['user']);
		$user = new User();
		$points = new Points();
		$pointsGiven = new PointsGiven();
		$pointsLog = new PointsLog();
		$pointsReceived = new PointsReceived();
		$currentUser = $this->get('security.token_storage')->getToken()->getUser();
		$currentUserPoints = $this->getUserPoints($currentUser->getId());
		$pointsGiven->setUserIdTo($searchUser->getId());
		$pointsGiven->setPoints($post['points']);
		$pointsGiven->setMessage($post['message']);
		$user->addPointsGiven($pointsGiven);
		$em->persist($pointsGiven);
		$em->flush();
		
		
		$pointsReceived->setUserIdFrom($currentUser->getId());
		$pointsReceived->setPoints($post['points']);
		$pointsReceived->setMessage($post['message']);
		$searchUser->addPointsReceived($pointsReceived);
		$em->persist($pointsReceived);
		$em->flush();
		
		//to do: decrease points of user that sent points
		
		return $this->render('UserBundle:Dashboard:profile.html.twig');
		// $pointsLog->
	}
	
	public function searchUserByEmail($email)
	{
		$repository = $this->getDoctrine()->getRepository('UserBundle:User');
		$user = $repository->findOneBy(
			array('email' => $email)
		);
		
		return $user;
	}
	
	public function getUserPoints($currentUser)
	{
		$repository = $this->getDoctrine()->getRepository('UserBundle:User');
		$points = $repository->findOneBy(
			array('id' => $currentUser)
		);
		
		return $points;
	}
}

{'fraction_non_alphanumeric': 0.15656108597285068, 'fraction_numerical': 0.0, 'mean_word_length': 5.454014598540146, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 69, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3514792', 'n_tokens_mistral': 1429, 'n_tokens_neox': 1317, 'n_words': 216}