Fix codestyle

pull/1590/head
Michael 2025-01-18 15:25:50 +00:00
parent 0c96d0f4bb
commit cb70a4eaff
1 changed files with 52 additions and 59 deletions

View File

@ -226,7 +226,8 @@ FROM (
return $answer; return $answer;
} }
protected function fillReplyGuyData(&$user) { protected function fillReplyGuyData(&$user)
{
$reply_guy_result = $this->getReplyGuyRow($user['user_contact_uid']); $reply_guy_result = $this->getReplyGuyRow($user['user_contact_uid']);
if (DBA::isResult($reply_guy_result)) { if (DBA::isResult($reply_guy_result)) {
$reply_guy_result_row = DBA::fetch($reply_guy_result); $reply_guy_result_row = DBA::fetch($reply_guy_result);
@ -235,22 +236,19 @@ FROM (
$user['reply_respondee_likes'] = $reply_guy_result_row['target_like_total'] ?? 0; $user['reply_respondee_likes'] = $reply_guy_result_row['target_like_total'] ?? 0;
$user['reply_op_likes'] = $reply_guy_result_row['original_like_total'] ?? 0; $user['reply_op_likes'] = $reply_guy_result_row['original_like_total'] ?? 0;
$denominator = $user['reply_likes'] + $user['reply_respondee_likes'] + $user['reply_op_likes']; $denominator = (int)($user['reply_likes'] + $user['reply_respondee_likes'] + $user['reply_op_likes']);
if ($user['reply_count'] == 0) { if ($user['reply_count'] == 0) {
$user['reply_guy'] = false; $user['reply_guy'] = false;
$user['reply_guy_score'] = 0; $user['reply_guy_score'] = 0;
} } elseif ($denominator == 0) {
elseif ($denominator == 0) {
$user['reply_guy'] = true; $user['reply_guy'] = true;
$user['reply_guy_score'] = '∞'; $user['reply_guy_score'] = '∞';
} } else {
else {
$reply_guy_score = $user['reply_count'] / $denominator; $reply_guy_score = $user['reply_count'] / $denominator;
$user['reply_guy'] = $reply_guy_score >= 1.0; $user['reply_guy'] = $reply_guy_score >= 1.0;
$user['reply_guy_score'] = $this->sigFig($reply_guy_score, 2); $user['reply_guy_score'] = $this->sigFig($reply_guy_score, 2);
} }
} } else {
else {
$user['reply_count'] = "error"; $user['reply_count'] = "error";
$user['reply_likes'] = "error"; $user['reply_likes'] = "error";
$user['reply_respondee_likes'] = "error"; $user['reply_respondee_likes'] = "error";
@ -272,9 +270,8 @@ FROM (
if (DBA::isResult($self_contact_result)) { if (DBA::isResult($self_contact_result)) {
$self_contact_result_row = DBA::fetch($self_contact_result); $self_contact_result_row = DBA::fetch($self_contact_result);
$user['user_contact_uid'] = $self_contact_result_row['user_contact_uid']; $user['user_contact_uid'] = $self_contact_result_row['user_contact_uid'];
} } else {
else { $user['user_contact_uid'] = null;
$user['user_contact_uid'] = NULL;
} }
if ($user['user_contact_uid']) { if ($user['user_contact_uid']) {
@ -286,28 +283,24 @@ FROM (
if ($user['reactions'] > 0) { if ($user['reactions'] > 0) {
$user['ratio'] = number_format($user['comments'] / $user['reactions'], 1, '.', ''); $user['ratio'] = number_format($user['comments'] / $user['reactions'], 1, '.', '');
$user['ratioed'] = (float)($user['ratio']) >= 2.0; $user['ratioed'] = (float)($user['ratio']) >= 2.0;
} } else {
else {
$user['reactions'] = 0; $user['reactions'] = 0;
if ($user['comments'] == 0) { if ($user['comments'] == 0) {
$user['comments'] = 0; $user['comments'] = 0;
$user['ratio'] = 0; $user['ratio'] = 0;
$user['ratioed'] = false; $user['ratioed'] = false;
} } else {
else {
$user['ratio'] = '∞'; $user['ratio'] = '∞';
$user['ratioed'] = false; $user['ratioed'] = false;
} }
} }
} } else {
else {
$user['comments'] = 'error'; $user['comments'] = 'error';
$user['reactions'] = 'error'; $user['reactions'] = 'error';
$user['ratio'] = 'error'; $user['ratio'] = 'error';
$user['ratioed'] = false; $user['ratioed'] = false;
} }
} } else {
else {
$user['comments'] = 'error'; $user['comments'] = 'error';
$user['reactions'] = 'error'; $user['reactions'] = 'error';
$user['ratio'] = 'error'; $user['ratio'] = 'error';