You are here

public function ChecklistapiChecklist::getPercentComplete in Checklist API 8

Gets the percentage of items complete.

Return value

float The percent complete.

File

src/ChecklistapiChecklist.php, line 200

Class

ChecklistapiChecklist
Defines the checklist class.

Namespace

Drupal\checklistapi

Code

public function getPercentComplete() {
  if ($this
    ->getNumberOfItems() == 0) {
    return 100;
  }
  return $this
    ->getNumberCompleted() / $this
    ->getNumberOfItems() * 100;
}