<commit_before><?php

namespace App\Presenters;

use App\Components\ReviewForm;
use App\Components\ReviewCommentForm;
use Nette\Application\UI\Form;
use Nette\Utils\Html;
use Model\Entity\Review;
use Model\Entity\ReviewComment;
use DateTime;
use Exception;

/**
 * Review presenter.
 */
class ReviewPresenter extends BasePresenter
{
    /** @var \Model\Repository\CourseRepository @inject */
    public $courseRepository;
    
    /** @var \Model\Repository\UnitRepository @inject */
    public $unitRepository;
    
    /** @var \Model\Repository\AssignmentRepository @inject */
    public $assignmentRepository;
    
    /** @var \Model\Repository\ReviewRepository @inject */
    public $reviewRepository;
    
    /** @var \Model\Repository\SolutionRepository @inject */
    public $solutionRepository;
    
    /** @var \Model\Repository\ReviewCommentRepository @inject */
    public $reviewCommentRepository;
    
    /** @var \Model\UploadStorage @inject */
    public $uploadStorage;    

    public function actionDefault($id) 
    {
        $this->setupCourseInfo($this->reviewRepository->find($id));
        $this->template->isFavorited = $this->courseInfo->review->isFavoritedBy($this->userInfo);
        $this->template->uploadPath = $this->uploadStorage->path;
    }

    public function renderDefault($id)
    {   
        $review = $this->courseInfo->review;
        
        $this->template->review = $review;
        $this->template->solution = $review->solution;
        $this->template->assignment = $review->solution->assignment;
    }
    
    public function actionWriteForUnit($id) 
    {
        $unit = $this->setupCourseInfo($this->unitRepository->find($id));
        if (!$unit->isCurrentPhase($unit::REVIEWS) AND !$this->user-isAllowed('review', 'writeAnytime')) {
            throw new \Nette\Application\BadRequestException('Forbidden', 403);
        }
        
        $this->template->uploadPath = $this->uploadStorage->path;
        <commit_msg>Bugfix: typo<commit_after><?php

namespace App\Presenters;

use App\Components\ReviewForm;
use App\Components\ReviewCommentForm;
use Nette\Application\UI\Form;
use Nette\Utils\Html;
use Model\Entity\Review;
use Model\Entity\ReviewComment;
use DateTime;
use Exception;

/**
 * Review presenter.
 */
class ReviewPresenter extends BasePresenter
{
    /** @var \Model\Repository\CourseRepository @inject */
    public $courseRepository;
    
    /** @var \Model\Repository\UnitRepository @inject */
    public $unitRepository;
    
    /** @var \Model\Repository\AssignmentRepository @inject */
    public $assignmentRepository;
    
    /** @var \Model\Repository\ReviewRepository @inject */
    public $reviewRepository;
    
    /** @var \Model\Repository\SolutionRepository @inject */
    public $solutionRepository;
    
    /** @var \Model\Repository\ReviewCommentRepository @inject */
    public $reviewCommentRepository;
    
    /** @var \Model\UploadStorage @inject */
    public $uploadStorage;    

    public function actionDefault($id) 
    {
        $this->setupCourseInfo($this->reviewRepository->find($id));
        $this->template->isFavorited = $this->courseInfo->review->isFavoritedBy($this->userInfo);
        $this->template->uploadPath = $this->uploadStorage->path;
    }

    public function renderDefault($id)
    {   
        $review = $this->courseInfo->review;
        
        $this->template->review = $review;
        $this->template->solution = $review->solution;
        $this->template->assignment = $review->solution->assignment;
    }
    
    public function actionWriteForUnit($id) 
    {
        $unit = $this->setupCourseInfo($this->unitRepository->find($id));
        if (!$unit->isCurrentPhase($unit::REVIEWS) AND !$this->user->isAllowed('review', 'writeAnytime')) {
            throw new \Nette\Application\BadRequestException('Forbidden', 403);
        }
        
        $this->template->uploadPath = $this->uploadStorage->path;
        
{'fraction_non_alphanumeric': 0.141051567239636, 'fraction_numerical': 0.0015166835187057635, 'mean_word_length': 3.104771784232365, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 70, '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': '1191830', 'n_tokens_mistral': 1126, 'n_tokens_neox': 1106, 'n_words': 191}