// день, из которого взяты данные (предшествующий). $eKC = $coeffs[$n30_cwdy]['by_e_from_c'] / $coeffs[$dwdy]['by_e_from_c']; // нормирование. $fKC = $coeffs[$n30_cwdy]['by_f_from_c'] / $coeffs[$dwdy]['by_f_from_c']; $uKC = $coeffs[$n30_cwdy]['by_u_from_c'] / $coeffs[$dwdy]['by_u_from_c']; } $eKC *= 1 + $K_wC * floor($npcnt / 7); $fKC *= 1 + $K_wC * floor($npcnt / 7); $uKC *= 1 + $K_wC * floor($npcnt / 7); $next30[$j] = array('by_e_from_c' => $n30p['by_e_from_c'] * $eKC, 'by_f_from_c' => $n30p['by_f_from_c'] * $fKC, 'by_u_from_c' => $n30p['by_u_from_c'] * $uKC, 'by_e_from_b' => $avg30['by_e_from_b'], 'by_f_from_b' => $avg30['by_f_from_b'], 'by_u_from_b' => $avg30['by_u_from_b'], 'by_e_from_p' => $avg30['by_e_from_p'], 'by_f_from_p' => $avg30['by_f_from_p'], 'by_u_from_p' => $avg30['by_u_from_p'], 'by_e_from_t' => $avg30['by_e_from_t'], 'by_f_from_t' => $avg30['by_f_from_t'], 'by_u_from_t' => $avg30['by_u_from_t'], 'by_e_from_o' => $avg30['by_e_from_o'], 'by_f_from_o' => $avg30['by_f_from_o'], 'by_u_from_o' => $avg30['by_u_from_o']); } else { // (4) Нет данных вообще. // Просто используем посещаемость юзера из ближайшего по популярности раздела, так, чтобы // рейтинг этого юзера был максимально приближен к исходному. if ($like_pro_uid = promotion::GetProFromLikeSpec($u_spec, $u_pro_rating)) { $smry_lpu = promotion::GetSummary($like_pro_uid); } $by_e_from_c = $smry_lpu ? ceil($smry_lpu['by_e_30d'] / 30) : 0; $by_f_from_c = $smry_lpu ? ceil($smry_lpu['by_f_30d'] / 30) : 0; $by_u_from_c = $smry_lpu ? ceil($smry_lpu['by_u_30d'] / 30) : 0; $next30[$j] = array('by_e_from_c' => $by_e_from_c, 'by_f_from_c' => $by_f_from_c, 'by_u_from_c' => $by_u_from_c, 'by_e_from_b' => $avg7['by_e_from_b'], 'by_f_from_b' => $avg7['by_f_from_b'], 'by_u_from_b' => $avg7['by_u_from_b'], 'by_e_from_p' => $avg7['by_e_from_p'], 'by_f_from_p' => $avg7['by_f_from_p'], 'by_u_from_p' => $avg7['by_u_from_p'], 'by_e_from_t' => $avg30['by_e_from_t'], 'by_f_from_t' => $avg30['by_f_from_t'], 'by_u_from_t' => $avg30['by_u_from_t'], 'by_e_from_o' => $avg30['by_e_from_o'], 'by_f_from_o' => $avg30['by_f_from_o'], 'by_u_from_o' => $avg30['by_u_from_o']); } } else { $A = $p27data['data']['A']; $B = $p27data['data']['B']; $C = $p27data['data']['C']; $D = $p27data['data']['D']; $E = $p27data['data']['E']; $by_e_from_c = ceil((1 * (int) $A['by_e'] + 2 * (int) $B['by_e'] + 3 * (int) $C['by_e'] + 2 * (int) $D['by_e'] + 1 * (int) $E['by_e']) / (!!$A + 2 * !!$B + 3 * !!$C + 2 * !!$D + !!$E) * $p27data['eKC']); $by_f_from_c = ceil((1 * (int) $A['by_f'] + 2 * (int) $B['by_f'] + 3 * (int) $C['by_f'] + 2 * (int) $D['by_f'] + 1 * (int) $E['by_f']) / (!!$A + 2 * !!$B + 3 * !!$C + 2 * !!$D + !!$E) * $p27data['fKC']); $by_u_from_c = ceil((1 * (int) $A['by_u'] + 2 * (int) $B['by_u'] + 3 * (int) $C['by_u'] + 2 * (int) $D['by_u'] + 1 * (int) $E['by_u']) / (!!$A + 2 * !!$B + 3 * !!$C + 2 * !!$D + !!$E) * $p27data['uKC']);