<commit_before><?php
/**
 * @author <NAME> (http://honzacerny.com)
 * @author <NAME> <<EMAIL>>
 */

namespace app\FrontModule\presenters;

use Nette\Application\UI\Form,
	Nette\Utils\DateTime;
use Nette\Utils\Paginator;

class DashboardPresenter extends DiaryPresenter
{
	/**
	 * @var int
	 */
	public $page = 1;

	public function renderDefault()
	{

		# Send unauth users away - we should do so in parent Presenter
		if ( $this->user->isLoggedIn() !== true ){
			$this->redirect('homepage:default');
		}

		# dashboard is used as a nifty router,
		# based on data e decide what to show, if in doubts display links

		$now = new DateTime();
		$last = $this -> template -> days = $this-> dayManager -> findAllDaysForUser($this->user->id)->order('date DESC')->limit(1) -> fetch();
		if ($last === FALSE){
			# no day, lets start with dashboard
			$this->redirect('Dashboard:list');
		}
		if (!$last['end_time']){
			if ($last['date'] == $now->format('Y-m-d 00:00:00')){
				$this->redirect('Evening:default');
			}
			# Older day, just forgot it!
			$this->redirect('Morning:default');
		}
		if ($last['date'] == $now->format('Y-m-d 00:00:00')){
			$this->redirect('Dashboard:list');
		}
		# there is no event, we start with welcome on Dashboard:list


		# show morning

		$this->redirect('Morning:default');

		# last choice is to show list
	}

	public function renderList($page = 1)
	{
		# Send unauth users away - we should do so in parent Presenter
		if ( $this->user->isLoggedIn() !== true ){
			$this->redirect('homepage:default');
		}


		$this->page = $page;

		$paginator = new Paginator();
		$paginator->setItemsPerPage(10);<commit_msg>set ItemsPerPage to 7 as week has got 7 days<commit_after><?php
/**
 * @author <NAME> (http://honzacerny.com)
 * @author <NAME> <<EMAIL>>
 */

namespace app\FrontModule\presenters;

use Nette\Application\UI\Form,
	Nette\Utils\DateTime;
use Nette\Utils\Paginator;

class DashboardPresenter extends DiaryPresenter
{
	/**
	 * @var int
	 */
	public $page = 1;

	public function renderDefault()
	{

		# Send unauth users away - we should do so in parent Presenter
		if ( $this->user->isLoggedIn() !== true ){
			$this->redirect('homepage:default');
		}

		# dashboard is used as a nifty router,
		# based on data e decide what to show, if in doubts display links

		$now = new DateTime();
		$last = $this -> template -> days = $this-> dayManager -> findAllDaysForUser($this->user->id)->order('date DESC')->limit(1) -> fetch();
		if ($last === FALSE){
			# no day, lets start with dashboard
			$this->redirect('Dashboard:list');
		}
		if (!$last['end_time']){
			if ($last['date'] == $now->format('Y-m-d 00:00:00')){
				$this->redirect('Evening:default');
			}
			# Older day, just forgot it!
			$this->redirect('Morning:default');
		}
		if ($last['date'] == $now->format('Y-m-d 00:00:00')){
			$this->redirect('Dashboard:list');
		}
		# there is no event, we start with welcome on Dashboard:list


		# show morning

		$this->redirect('Morning:default');

		# last choice is to show list
	}

	public function renderList($page = 1)
	{
		# Send unauth users away - we should do so in parent Presenter
		if ( $this->user->isLoggedIn() !== true ){
			$this->redirect('homepage:default');
		}


		$this->page = $page;

		$paginator = new Paginator();
		$paginator->setItemsPerPage(7);
{'fraction_non_alphanumeric': 0.17420132610006028, 'fraction_numerical': 0.010548523206751054, 'mean_word_length': 3.7414285714285715, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 59, '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': '972044', 'n_tokens_mistral': 1264, 'n_tokens_neox': 1125, 'n_words': 298}