<?php

namespace App\Model;

use Nette;

class EvaluationManager
{
	use Nette\SmartObject;

	private Nette\Database\Explorer $database;

	public function __construct(Nette\Database\Explorer $database)
	{
		$this->database = $database;
	}

	public function getByPersonIdCourseId($personId, $courseId)
	{
		$result = $this->database->table('hodnoceni')->where('ID_hodnoceneho = ? AND ID_kurzu = ?', $personId, $courseId);
		if($result->count('*') == 0) {
			return null;
		}
		return $result->fetch();
	}
}