/** * Automatically aggregate games from otg_rangers_games and update/insert otg_coach_statistics. */ private static function sync_rangers_season_stats($coach_id, $season) { global $wpdb; if ($coach_id <= 0 || empty($season)) { echo '

Invalid Coach or Season specified for sync.

'; return; } // 1. Regular Season Calculation (game_type = 2) $reg_sql = $wpdb->prepare( "SELECT COUNT(*) as gc, SUM(CASE WHEN rangers_score > opponent_score THEN 1 ELSE 0 END) as wins, SUM(CASE WHEN rangers_score < opponent_score AND overtime_status != 'OT' AND overtime_status != 'SO' THEN 1 ELSE 0 END) as losses, SUM(CASE WHEN rangers_score = opponent_score THEN 1 ELSE 0 END) as ties, SUM(CASE WHEN rangers_score < opponent_score AND overtime_status = 'OT' THEN 1 ELSE 0 END) as ot, SUM(CASE WHEN rangers_score < opponent_score AND overtime_status = 'SO' THEN 1 ELSE 0 END) as sol, SUM(CASE WHEN rangers_score > opponent_score AND overtime_status = 'SO' THEN 1 ELSE 0 END) as sow FROM otg_rangers_games WHERE game_type = 2 AND season = %s", $season ); $reg = $wpdb->get_row($reg_sql); // 2. Playoff Calculation (game_type = 3) - Fetching series/opponent details ordered by date/game $playoff_games_sql = $wpdb->prepare( "SELECT opponent, rangers_score, opponent_score FROM otg_rangers_games WHERE game_type = 3 AND season = %s ORDER BY game_date ASC, game_id ASC", $season ); $playoff_games = $wpdb->get_results($playoff_games_sql); $gc = $reg->gc ? intval($reg->gc) : 0; $w = $reg->wins ? intval($reg->wins) : 0; $l = $reg->losses ? intval($reg->losses) : 0; $t = $reg->ties !== null ? intval($reg->ties) : 0; $ot = $reg->ot !== null ? intval($reg->ot) : 0; $sol = $reg->sol !== null ? intval($reg->sol) : 0; $sow = $reg->sow !== null ? intval($reg->sow) : 0; $pgc = count($playoff_games); $pw = 0; $pl = 0; $pt = 0; $sw = 0; $sl = 0; $sc = 0; $scf = 0; if ($pgc > 0) { $series_records = []; $current_opponent = null; $opp_wins = 0; $nyr_wins = 0; foreach ($playoff_games as $g) { if (intval($g->rangers_score) > intval($g->opponent_score)) { $pw++; $nyr_wins++; } elseif (intval($g->rangers_score) < intval($g->opponent_score)) { $pl++; $opp_wins++; } else { $pt++; } if ($current_opponent === null) { $current_opponent = $g->opponent; $nyr_wins = (intval($g->rangers_score) > intval($g->opponent_score)) ? 1 : 0; $opp_wins = (intval($g->rangers_score) < intval($g->opponent_score)) ? 1 : 0; } elseif ($current_opponent !== $g->opponent) { // Previous series concluded because opponent changed if ($nyr_wins > $opp_wins) { $sw++; } else { $sl++; } $current_opponent = $g->opponent; $nyr_wins = (intval($g->rangers_score) > intval($g->opponent_score)) ? 1 : 0; $opp_wins = (intval($g->rangers_score) < intval($g->opponent_score)) ? 1 : 0; } } // Final series check after loop finishes if ($current_opponent !== null) { // Check if this was the Stanley Cup Finals (last series) and if they won the Cup (4 wins in final series or overall context, typically 4 wins wins a modern NHL playoff series) if ($nyr_wins > $opp_wins) { $sw++; // If it's the final round and they won, check if it's the Stanley Cup win // (Assuming final round win equates to SC = 1 if it's the ultimate round) } else { $sl++; } } // Determine if they won the Stanley Cup (e.g. won 4 rounds total, or check standard criteria) // If they won 4 series in a 4-round playoff format, they are Stanley Cup Champions if ($sw >= 4) { $sc = 1; $scf = 1; } elseif ($sw == 3 && $sl > 0) { $scf = 1; $sc = 0; } } $data = array( 'CoachID' => $coach_id, 'Team' => 'New York Rangers', 'League' => 'NHL', 'Season' => $season, 'GC' => $gc, 'W' => $w, 'L' => $l, 'T' => $t, 'OT' => $ot, 'SOL' => $sol, 'SOW' => $sow, 'PGC' => $pgc, 'PW' => $pw, 'PL' => $pl, 'PT' => $pt, 'SCF' => $scf, 'SC' => $sc, 'SW' => $sw, 'SL' => $sl, ); $existing = $wpdb->get_var($wpdb->prepare( "SELECT COUNT(*) FROM otg_coach_statistics WHERE CoachID = %d AND Season = %s AND Team = 'New York Rangers'", $coach_id, $season )); if ($existing > 0) { $wpdb->update('otg_coach_statistics', $data, array('CoachID' => $coach_id, 'Season' => $season, 'Team' => 'New York Rangers')); echo '

Successfully synced Rangers stats for season ' . esc_html($season) . '!

'; } else { $wpdb->insert('otg_coach_statistics', $data); echo '

Successfully inserted synced Rangers stats for season ' . esc_html($season) . '!

'; } } GAME 70 NYR @ BOS 7:00pm MSG2 – Page 5 – Hit The Road Jake – OutsideTheGarden Boards
FEBRUARY
«
Fri
30
Sat
31
Sun
1
Mon
2
Tue
3
Wed
4
Thu
5
»
GAME 70 NYR @ BOS 7...
 
Notifications
Clear all

GAME 70 NYR @ BOS 7:00pm MSG2

Page 5 / 10
 
CuyllRanger
(@cuyllranger)
Hall of Famer

Posted by: @rangerjunkie

Kreider is the softest 220 pounder ever

 

Laviolette would have to be an idiot watching every game, and in the film room and not see what we see. I’m surprised there hasn’t been some kind of interaction with coach demanding Kreider get his nose dirty. 

 


ReplyQuote
Posted : 21/03/2024 7:27 pm
Fish
 Fish
(@fish)
Member Moderator

Posted by: @pierre_pdare

Posted by: @Anonymous

Posted by: @rangerjunkie

Kreider is the softest 220 pounder ever

Remember when he entered the league and was getting penalties because he hit too hard?

He's "adjusted".

The Rangers as a team lack physicality

I'm not sure they're that far away, certainly are trending towards more physical players from the draft on out.  I think his first year he was too focused on guys who were one dimensional, overrated or past their prime like Reaves, Tinordi and Goodrow, but since then I think he's been doing a better job.

When you add in the additions of Cuylle and now Rempe and Edstrom, I think they're heading in the right direction.  Even guys like Schneider and the acquisition of Trocheck have given the team a bit more edge.

 

 

 


ReplyQuote
Topic starter Posted : 21/03/2024 7:30 pm
(@Anonymous 4)

Another bad penalty by Fox.


ReplyQuote
Posted : 21/03/2024 7:31 pm
Rangerjunkiekimmie
(@rangerjunkie)
NHL All Star

Fox with another penalty


De Oppresso Liber..
from the left elites

ReplyQuote
Posted : 21/03/2024 7:31 pm
Doug Glatt
(@pierre_pdare)
Legend

Fox to the box


If they need me to bleed, then I'll bleed for my team

ReplyQuote
Posted : 21/03/2024 7:31 pm
(@rosie-larose)
First Liner

Posted by: @Anonymous

Posted by: @rangerjunkie

Kreider is the softest 220 pounder ever

Laviolette would have to be an idiot watching every game, and in the film room and not see what we see. I’m surprised there hasn’t been some kind of interaction with coach demanding Kreider get his nose dirty. 

 

A Leopard doesn’t change its spots.  This is who he is. 

 


ReplyQuote
Posted : 21/03/2024 7:32 pm
Rangerjunkiekimmie
(@rangerjunkie)
NHL All Star

Posted by: @fish

Posted by: @pierre_pdare

Posted by: @Anonymous

Posted by: @rangerjunkie

Kreider is the softest 220 pounder ever

Remember when he entered the league and was getting penalties because he hit too hard?

He's "adjusted".

The Rangers as a team lack physicality

I'm not sure they're that far away, certainly are trending towards more physical players from the draft on out.  I think his first year he was too focused on guys who were one dimensional, overrated or past their prime like Reaves, Tinordi and Goodrow, but since then I think he's been doing a better job.

When you add in the additions of Cuylle and now Rempe and Edstrom, I think they're heading in the right direction.  Even guys like Schneider and the acquisition of Trocheck have given the team a bit more edge.

 

 

 

I agree with your assessment they are on the right track. But Kreider is just way to soft for how big he actually is

 


De Oppresso Liber..
from the left elites

ReplyQuote
Posted : 21/03/2024 7:33 pm
(@rosie-larose)
First Liner

Fox with another lazy penalty.  Ho Lee Fuk


ReplyQuote
Posted : 21/03/2024 7:33 pm
Rangerjunkiekimmie
(@rangerjunkie)
NHL All Star

Posted by: @pierre_pdare

Fox to the box

Hahaha a true poet

 


De Oppresso Liber..
from the left elites

ReplyQuote
Posted : 21/03/2024 7:34 pm
(@Anonymous 4)

Only Kreider could have missed that one.


ReplyQuote
Posted : 21/03/2024 7:34 pm
Fish
 Fish
(@fish)
Member Moderator

Geez, Kreider close there


ReplyQuote
Topic starter Posted : 21/03/2024 7:34 pm
CuyllRanger
(@cuyllranger)
Hall of Famer

Nice job by 5


ReplyQuote
Posted : 21/03/2024 7:35 pm
Fish
 Fish
(@fish)
Member Moderator

Posted by: @Anonymous

Only Kreider could have missed that one.

Swayman got it and then it just deflected over the net

 


ReplyQuote
Topic starter Posted : 21/03/2024 7:35 pm
(@Anonymous 4)

Now that is a lucky bounce.


ReplyQuote
Posted : 21/03/2024 7:35 pm
Fish
 Fish
(@fish)
Member Moderator

Panarin with the ol' pass into the net to put the good guys in the lead


ReplyQuote
Topic starter Posted : 21/03/2024 7:36 pm
Page 5 / 10
Share: