public function getCompletedFeaturesCount($userId, array $features) { if (empty($userId) || count($features) === 0) { return NULL; } $perDay = OW::getConfig()->getValue('profileprogressbar', 'per_day'); $example = new OW_Example(); $example->andFieldEqual(self::USER_ID, $userId); $example->andFieldInArray(self::ENTITY_TYPE, $features); $example->andFieldBetween(self::TIME_STAMP, strtotime("-{$perDay} day"), time()); return $this->countByExample($example); }
public function countUserPostByPeriod($id, $lb, $ub) { $ex = new OW_Example(); $ex->andFieldEqual('authorId', $id); $ex->andFieldBetween('timestamp', $lb, $ub); $ex->andFieldEqual('isDraft', 0); $ex->setOrder('`timestamp` DESC'); return $this->countByExample($ex); }
/** * @param OW_Example$example * @param array $params */ private function applyDatesBetweenFilter(OW_Example $example, $params) { if (isset($params['start'], $params['end'])) { $start = $params['start']; $end = $params['end']; if (!is_null($start) && !is_null($end)) { $example->andFieldBetween('addDatetime', $start, $end); } } }