// ========================================================================= // HOT & COLD PLAYERS WIDGET // ========================================================================= add_shortcode('otg_hot_cold_widget', 'otg_render_hot_cold_widget'); function otg_get_hot_cold_rangers() { global $wpdb; // 1. Fetch players where Status is 'Rangers' and nhl_id is valid $active_rangers = $wpdb->get_results(" SELECT ID, Name, nhl_id FROM otg_players WHERE Status = 'Rangers' AND nhl_id > 0 "); $player_scores = array(); foreach ($active_rangers as $player) { // 2. Fetch the last 10 games specifically played FOR the Rangers (team_abbr = 'NYR') $games = $wpdb->get_results($wpdb->prepare(" SELECT b.goals, b.assists, b.shots, g.game_date FROM otg_rangers_player_boxscores b JOIN otg_rangers_games g ON b.game_id = g.game_id WHERE b.player_id = %d AND b.team_abbr = 'NYR' ORDER BY g.game_date DESC, g.game_id DESC LIMIT 10 ", $player->nhl_id)); if (empty($games)) { continue; } // Reverse to chronological order: oldest to newest $games = array_reverse($games); $total_games = count($games); $score = 0; // 3. Apply weighted calculation (more recent games get a higher multiplier weight) foreach ($games as $index => $g) { $recency_weight = ($index + 1) / $total_games; $goals = intval($g->goals); $assists = intval($g->assists); $shots = intval($g->shots); // Goal weight > Assist weight > Shot (SOG) weight $game_points = ($goals * 5.0) + ($assists * 3.0) + ($shots * 0.4); $score += ($game_points * $recency_weight); } $player_scores[] = [ 'id' => $player->ID, 'name' => $player->Name, 'score' => round($score, 2), 'games_analyzed' => $total_games ]; } // 4. Sort players by score descending usort($player_scores, function($a, $b) { return $b['score'] <=> $a['score']; }); // Split into Hot (top 5) and Not (bottom 5) $hot = array_slice($player_scores, 0, 5); $not = array_slice(array_reverse($player_scores), 0, 5); return [ 'hot' => $hot, 'not' => $not ]; } function otg_render_hot_cold_widget() { $data = otg_get_hot_cold_rangers(); $hot = $data['hot']; $not = $data['not']; $html = '
'; // Who is Hot Box (Orange theme) $html .= '
'; $html .= '

🔥 Who Is Hot

'; $html .= '
'; // Who is Not Box (Blue theme) $html .= '
'; $html .= '

❄️ Who Is Not

'; $html .= '
'; $html .= '
'; return $html; } Rangerjunkiekimmie – Activity – OutsideTheGarden Boards – Page 24
JUNE
«
Tue
8
Wed
9
Thu
10
Fri
11
Sat
12
Sun
13
Mon
14
»
Rangerjunkiekimmie
Rangerjunkiekimmie
Group: Registered
Joined: 2023-08-26
NHL All Star
2
Follow
Fox tried real hard with the poke check

In forum Where Smit Hits The Fan

2 years ago
2 goals in 16 seconds

In forum Where Smit Hits The Fan

2 years ago
Rempe needs to come up with a new breakaway move

In forum Where Smit Hits The Fan

2 years ago
JT won't get an assist there but he should Rangers 1-0

In forum Where Smit Hits The Fan

2 years ago
Of course Rangers do some nice work in Bostons end and Mika ...

In forum Where Smit Hits The Fan

2 years ago
Pinned again

In forum Where Smit Hits The Fan

2 years ago
Rangers pinned Kreider is horrible

In forum Where Smit Hits The Fan

2 years ago
5 minute major and a 15 game suspension

In forum Where Smit Hits The Fan

2 years ago
Hahaha

In forum Where Smit Hits The Fan

2 years ago
Agree

In forum Where Smit Hits The Fan

2 years ago
Miller rubbing off on Cuylle

In forum Where Smit Hits The Fan

2 years ago
Never should've traded JT in the first place

In forum Where Smit Hits The Fan

2 years ago
Rempe watching the STAR players on the team and passes inste...

In forum Where Smit Hits The Fan

2 years ago
Please bring in more JT types.......PLEASE

In forum Where Smit Hits The Fan

2 years ago
18.8 left Rangers wilt 0-1

In forum Where Smit Hits The Fan

2 years ago
Page 24 / 106