refactor: staff count function

main
gravel 2 months ago
parent 56a17c68ff
commit 53964f09d9
Signed by: gravel
GPG Key ID: C0538F3C906B308F

@ -399,6 +399,14 @@
));
}
/**
* Return the number of unique Community staff.
* @return int
*/
function get_staff_count(): int {
return count($this->get_staff());
}
/**
* Return duration in seconds since room was created.
*/
@ -691,7 +699,7 @@
* @return bool
*/
public function has_good_staff_rating(): bool {
$staff_count = count($this->get_staff());
$staff_count = $this->get_staff_count();
return $staff_count >= $this->get_recommended_staff_count();
}
@ -702,7 +710,7 @@
*/
public function get_numeric_staff_rating(): float {
if (!$this->write || !$this->read) return 2;
return min(2, count($this->get_staff()) / $this->get_recommended_staff_count());
return min(2, $this->get_staff_count() / $this->get_recommended_staff_count());
}
/**
@ -720,7 +728,7 @@
* Estimate whether the Community does not have enough staff.
*/
public function has_poor_staff_rating(): bool {
return count($this->get_staff()) < $this->get_minimal_staff_count();
return $this->get_staff_count() < $this->get_minimal_staff_count();
}
/**

Loading…
Cancel
Save