public function renderDetail($code) { $rating = new \Nette\Database\Table\Selection($this->context->database->getConnection(), 'subject_rating', $this->context->reflection); $s = $this->context->createServicePlaces()->where('code', $code)->fetch(); $this->template->rating = $rating->select('sum(thumb_up) thumb_up, sum(thumb_down) thumb_down, round(sum(thumb_up)/(sum(thumb_up)+sum(thumb_down))*100) thumb_up_percent')->where('subject_id', $s)->group('subject_id')->fetch(); }
public function renderDetail($id) { $rating = new \Nette\Database\Table\Selection($this->context->database->getConnection(), 'event_rating', $this->context->reflection); $this->template->rating = $rating->select('sum(thumb_up) thumb_up, sum(thumb_down) thumb_down, round(sum(thumb_up)/(sum(thumb_up)+sum(thumb_down))*100) thumb_up_percent')->where('event_id', $id)->group('event_id')->fetch(); }