You are here

public function ChecklistapiChecklist::getPercentComplete in Checklist API 7

Gets the percentage of items complete.

Return value

float The percent complete.

File

lib/Drupal/checklistapi/ChecklistapiChecklist.php, line 156
Class for Checklist API checklists.

Class

ChecklistapiChecklist
Defines the checklist class.

Code

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