refactor: use constant for max staff rating

dev
gravel 1 year ago
parent 8cf81e8b1e
commit 67a1d803e0
No known key found for this signature in database
GPG Key ID: CA95FFF4E0123903

@ -722,14 +722,22 @@
return $staff_count >= $this->get_recommended_staff_count(); return $staff_count >= $this->get_recommended_staff_count();
} }
const MAX_STAFF_RATING = 2;
/** /**
* Return a rating for the Community's staff count relative to active users. * Return a rating for the Community's staff count relative to active users.
* *
* @return float * @return float
*/ */
public function get_numeric_staff_rating(): float { public function get_numeric_staff_rating(): float {
if (!$this->write || !$this->read) return 2; if (!$this->write || !$this->read) {
return min(2, $this->get_staff_count() / $this->get_recommended_staff_count()); return CommunityRoom::MAX_STAFF_RATING;
}
return min(
CommunityRoom::MAX_STAFF_RATING,
$this->get_staff_count() / $this->get_recommended_staff_count()
);
} }
/** /**

Loading…
Cancel
Save