Determines if given achievement was completed.

@param Achievement $achievement

@return bool
179797
protected function isCompletedAchievement(Achievement $achievement): bool
    {
        $completedCriterias = array_filter($achievement->criterias(), function (AchievementCriteria $criteria) {
            return $this->isCompletedCriteria($criteria, $criteria->progress());
        });

        return count($achievement->criterias()) === count($completedCriterias);
    }
1175329
protected function succeed($result = null)
    {
        $this->isFinished = true;
        $this->isSuccess = true;
        $this->result = $result;
    }
567428
public static function getUnsyncedByAchiever($achiever)
    {
        $className = (new static)->getAchieverClassName($achiever);

        $achievements = AchievementProgress::where('achiever_type', $className)
                                           ->where('achiever_id', $achiever->id)->get();
        $synced_ids = $achievements->map(function ($el) {
            return $el->achievement_id;
        })->toArray();

        return self::whereNotIn('id', $synced_ids);
    }
1123037
public function review($completion, $mark = true) {
        $timeenrolled = $this->get_timeenrolled($completion);

        // If duration since enrollment has passed
        if (!$this->enrolperiod || !$timeenrolled) {
            return false;
        }

        if (time() > ($timeenrolled + $this->enrolperiod)) {
            if ($mark) {
                $completion->mark_complete();
            }

            return true;
        }

        return false;
    }
272323
def _parse_achievements(self, rows):
        
        for row in rows:
            cols = row.find_all('td')
            if len(cols) != 2:
                continue
            field, value = cols
            grade = str(field).count("achievement-grade-symbol")
            name = value.text.strip()
            self.achievements.append(Achievement(name, grade))
324733
public function has($property)
    {
        if (is_array($property)) {
            foreach ($property as $item) {
                if (is_a($this->{$item}, '\\TYPO3\\CMS\\Extbase\\Persistence\\ObjectStorage')) {
                    return ($this->{$item}->count()) ? true : false;
                } else {
                    return (!empty($this->{$item})) ? true : false;
                }
            }
        } else {
            if (is_a($this->{$property}, '\\TYPO3\\CMS\\Extbase\\Persistence\\ObjectStorage')) {
                return ($this->{$property}->count()) ? true : false;
            } else {
                return (!empty($this->{$property})) ? true : false;
            }
        }
    }
573464
public function parse($achievement)
    {
        // add default fields
        $this->id = $achievement['achievement']['id'];
        $this->name = $achievement['achievement']['name'];
        $this->category = $achievement['achievement']['category'];

        // add requirements if available
        if (isset($achievement['requirements'])) {
            $this->requirements = $achievement['requirements'];
        }

        // add user state if available
        if (isset($achievement['level'])) {
            $this->level = $achievement['level'];
        }
        if (isset($achievement['score'])) {
            $this->score = $achievement['score'];
        }
    }
110776
public function isFinalized($error = false)
    {
        if ($this->finalized && $error) {
            $this->triggerError($error, E_USER_ERROR);
        }
        return $this->finalized;
    }
742688
public function getAchievementByName($achievementName)
    {
        /** @var Achievement $achievement */
        foreach ($this->getAchievements() as $achievement) {
            if ($achievement->getName() == $achievementName) {
                return $achievement;
            }
        }

        return null;
    }
981919
public function isSimple(): bool {
        $event = new AccessorOpEvent($this);
        $this->fireOperationEvent(AccessorOpEvent::IS_SIMPLE_EVENT, $event);
        return $event->getResults();
    }
1068483
public function getAchievementsApi()
    {
        if (!$this->apis->has('achievements')) {
            $this->apis->set('achievements', new Achievements($this));
            ;
        }

        return $this->apis->get('achievements');
    }
784068
public function isCompleted( $strict = true ) {

		if( $strict ) {

			return $this->status == self::STATUS_COMPLETED;
		}

		return $this->status >= self::STATUS_COMPLETED;
	}
1338985
private function hasPassed(TaskExecutionInterface $execution, $result)
    {
        // this find is necessary because the storage could be
        // invalid (clear in doctrine) after handling an execution.
        $execution = $this->taskExecutionRepository->findByUuid($execution->getUuid());
        $execution->setStatus(TaskStatus::COMPLETED);
        $execution->setResult($result);

        $this->eventDispatcher->dispatch(
            Events::TASK_PASSED,
            new TaskExecutionEvent($execution->getTask(), $execution)
        );

        return $execution;
    }
891101
public function hasCompleteExportIgnores()
    {
        $expectedExportIgnores = $this->collectExpectedExportIgnores();

        if ($expectedExportIgnores === [] || $this->hasGitattributesFile() === false) {
            return false;
        }

        $actualExportIgnores = $this->getPresentExportIgnores();

        if ($this->isStrictAlignmentCamparisonEnabled()) {
            $expectedExportIgnores = $this->getAlignedExportIgnoreArtifacts(
                $expectedExportIgnores
            );
        }

        return array_values($expectedExportIgnores) === array_values($actualExportIgnores);
    }
92714
public function getAchievementMapper()
    {
        if (null === $this->achievementMapper) {
            $this->achievementMapper = $this->serviceLocator->get('playgroundreward_achievement_mapper');
        }

        return $this->achievementMapper;
    }
225485
protected function checkResqueStatus($status) {
		switch($status) {
			case "Complete":
				return true;
			case "Failed":
			case "Invalid":
				$this->log("{$this->Title} failed with task status $status");
				$this->markFailed();
				return false;
			case "Queued":
			case "Running":
			default:
				// For running or queued tasks ensure that we have not exceeded
				// a reasonable time-elapsed to consider this job inactive
				if($this->isTimedOut()) {
					$this->log("{$this->Title} took longer than {$this->MaxDuration} seconds to run and has timed out");
					$this->markFailed();
					return false;
				} else {
					// While still running report no error, waiting for resque job to eventually finish
					// some time in the future
					$this->log("{$this->Title} is still in progress");
					return false;
				}
		}
	}
1300884
def get_achievements(self, name):
        
        postgame = self.get_postgame()
        if not postgame:
            return None
        for achievements in postgame.achievements:
            # achievements player name can be shorter
            if name.startswith(achievements.player_name.replace(b'\x00', b'')):
                return achievements
        return None