/** * Calculate calories if empty */ protected function calculateCaloriesIfZero() { if ($this->Object->calories() == 0 && $this->Object->sportid() > 0) { $Factory = \Runalyze\Context::Factory(); $calories = $Factory->sport($this->Object->sportid())->caloriesPerHour() * $this->Object->duration() / 3600; $this->Object->set(Object::CALORIES, $calories); } }
/** * Get calories with unit * @return string */ public function calories() { return Helper::Unknown($this->Activity->calories()) . ' kcal'; }