require "./setup"
_ { Swars::User["SugarHuuko"].stat.daily_average_matches_stat.average }        # => "294.72 ms"
_ { Swars::User["SugarHuuko"].stat.daily_average_matches_stat.max }            # => "29.85 ms"
s { tp Swars::User["SugarHuuko"].stat.daily_average_matches_stat.average }     # => 25.0
s { tp Swars::User["SugarHuuko"].stat.daily_average_matches_stat.max }         # => 34
# >>   Swars::User Load (0.2ms)  SELECT `swars_users`.* FROM `swars_users` WHERE `swars_users`.`user_key` = 'SugarHuuko' LIMIT 1 /*application='ShogiWeb'*/
# >>   ↳ app/models/swars/user.rb:44:in 'Swars::User.[]'
# >>   Swars::Membership Ids (8.4ms)  SELECT `swars_memberships`.`id` FROM `swars_memberships` INNER JOIN `swars_battles` ON `swars_battles`.`id` = `swars_memberships`.`battle_id` WHERE `swars_memberships`.`user_id` = 17413 ORDER BY `swars_battles`.`battled_at` DESC LIMIT 50 /*application='ShogiWeb'*/
# >>   ↳ app/models/swars/user/stat/scope_ext.rb:31:in 'Swars::User::Stat::ScopeExt#scope_ids'
# >>   Swars::Membership Count (0.6ms)  SELECT COUNT(*) FROM `swars_memberships` WHERE `swars_memberships`.`id` IN (118689399, 118689421, 118689422, 118689424, 118689426, 118689429, 118689431, 118689432, 118689435, 118738139, 118738150, 118738161, 118738164, 118738165, 118738168, 118738170, 118689445, 118738172, 118738173, 118689402, 118689403, 118689406, 118689407, 118689410, 118689411, 118689414, 118663205, 118689419, 118686043, 118664996, 118665000, 118695959, 118658894, 118702422, 118652311, 118652317, 118652321, 118649898, 118649900, 118649901, 118649903, 118649906, 118649907, 118647740, 118647742, 118647744, 118647747, 118645471, 118645476, 118645480) /*application='ShogiWeb'*/
# >>   ↳ app/models/swars/user/stat/scope_ext.rb:41:in 'Swars::User::Stat::ScopeExt#ids_count'
# >>   Swars::Membership Load (0.5ms)  SELECT DATE(DATE_SUB(CONVERT_TZ(battled_at, 'UTC', 'Asia/Tokyo'), INTERVAL 3 HOUR)) AS battled_on, COUNT(*) AS count_all FROM `swars_memberships` INNER JOIN `swars_battles` ON `swars_battles`.`id` = `swars_memberships`.`battle_id` WHERE `swars_memberships`.`id` IN (118689399, 118689421, 118689422, 118689424, 118689426, 118689429, 118689431, 118689432, 118689435, 118738139, 118738150, 118738161, 118738164, 118738165, 118738168, 118738170, 118689445, 118738172, 118738173, 118689402, 118689403, 118689406, 118689407, 118689410, 118689411, 118689414, 118663205, 118689419, 118686043, 118664996, 118665000, 118695959, 118658894, 118702422, 118652311, 118652317, 118652321, 118649898, 118649900, 118649901, 118649903, 118649906, 118649907, 118647740, 118647742, 118647744, 118647747, 118645471, 118645476, 118645480) GROUP BY `battled_on` /*application='ShogiWeb'*/
# >>   ↳ app/models/swars/user/stat/daily_average_matches_stat.rb:43:in 'block (2 levels) in Swars::User::Stat::DailyAverageMatchesStat#aggregate_outcome'
# >>    (0.6ms)  SELECT AVG(count_all) AS average, MAX(count_all) AS max FROM (SELECT DATE(DATE_SUB(CONVERT_TZ(battled_at, 'UTC', 'Asia/Tokyo'), INTERVAL 3 HOUR)) AS battled_on, COUNT(*) AS count_all FROM `swars_memberships` INNER JOIN `swars_battles` ON `swars_battles`.`id` = `swars_memberships`.`battle_id` WHERE `swars_memberships`.`id` IN (118689399, 118689421, 118689422, 118689424, 118689426, 118689429, 118689431, 118689432, 118689435, 118738139, 118738150, 118738161, 118738164, 118738165, 118738168, 118738170, 118689445, 118738172, 118738173, 118689402, 118689403, 118689406, 118689407, 118689410, 118689411, 118689414, 118663205, 118689419, 118686043, 118664996, 118665000, 118695959, 118658894, 118702422, 118652311, 118652317, 118652321, 118649898, 118649900, 118649901, 118649903, 118649906, 118649907, 118647740, 118647742, 118647744, 118647747, 118645471, 118645476, 118645480) GROUP BY `battled_on`) AS from_values /*application='ShogiWeb'*/
# >>   ↳ app/models/swars/user/stat/daily_average_matches_stat.rb:45:in 'block in Swars::User::Stat::DailyAverageMatchesStat#aggregate_outcome'
# >> |------|
# >> | 25.0 |
# >> |------|
# >>   Swars::User Load (0.2ms)  SELECT `swars_users`.* FROM `swars_users` WHERE `swars_users`.`user_key` = 'SugarHuuko' LIMIT 1 /*application='ShogiWeb'*/
# >>   ↳ app/models/swars/user.rb:44:in 'Swars::User.[]'
# >>   Swars::Membership Ids (7.3ms)  SELECT `swars_memberships`.`id` FROM `swars_memberships` INNER JOIN `swars_battles` ON `swars_battles`.`id` = `swars_memberships`.`battle_id` WHERE `swars_memberships`.`user_id` = 17413 ORDER BY `swars_battles`.`battled_at` DESC LIMIT 50 /*application='ShogiWeb'*/
# >>   ↳ app/models/swars/user/stat/scope_ext.rb:31:in 'Swars::User::Stat::ScopeExt#scope_ids'
# >>   Swars::Membership Count (0.7ms)  SELECT COUNT(*) FROM `swars_memberships` WHERE `swars_memberships`.`id` IN (118689399, 118689421, 118689422, 118689424, 118689426, 118689429, 118689431, 118689432, 118689435, 118738139, 118738150, 118738161, 118738164, 118738165, 118738168, 118738170, 118689445, 118738172, 118738173, 118689402, 118689403, 118689406, 118689407, 118689410, 118689411, 118689414, 118663205, 118689419, 118686043, 118664996, 118665000, 118695959, 118658894, 118702422, 118652311, 118652317, 118652321, 118649898, 118649900, 118649901, 118649903, 118649906, 118649907, 118647740, 118647742, 118647744, 118647747, 118645471, 118645476, 118645480) /*application='ShogiWeb'*/
# >>   ↳ app/models/swars/user/stat/scope_ext.rb:41:in 'Swars::User::Stat::ScopeExt#ids_count'
# >>   Swars::Membership Load (0.6ms)  SELECT DATE(DATE_SUB(CONVERT_TZ(battled_at, 'UTC', 'Asia/Tokyo'), INTERVAL 3 HOUR)) AS battled_on, COUNT(*) AS count_all FROM `swars_memberships` INNER JOIN `swars_battles` ON `swars_battles`.`id` = `swars_memberships`.`battle_id` WHERE `swars_memberships`.`id` IN (118689399, 118689421, 118689422, 118689424, 118689426, 118689429, 118689431, 118689432, 118689435, 118738139, 118738150, 118738161, 118738164, 118738165, 118738168, 118738170, 118689445, 118738172, 118738173, 118689402, 118689403, 118689406, 118689407, 118689410, 118689411, 118689414, 118663205, 118689419, 118686043, 118664996, 118665000, 118695959, 118658894, 118702422, 118652311, 118652317, 118652321, 118649898, 118649900, 118649901, 118649903, 118649906, 118649907, 118647740, 118647742, 118647744, 118647747, 118645471, 118645476, 118645480) GROUP BY `battled_on` /*application='ShogiWeb'*/
# >>   ↳ app/models/swars/user/stat/daily_average_matches_stat.rb:43:in 'block (2 levels) in Swars::User::Stat::DailyAverageMatchesStat#aggregate_outcome'
# >>    (1.0ms)  SELECT AVG(count_all) AS average, MAX(count_all) AS max FROM (SELECT DATE(DATE_SUB(CONVERT_TZ(battled_at, 'UTC', 'Asia/Tokyo'), INTERVAL 3 HOUR)) AS battled_on, COUNT(*) AS count_all FROM `swars_memberships` INNER JOIN `swars_battles` ON `swars_battles`.`id` = `swars_memberships`.`battle_id` WHERE `swars_memberships`.`id` IN (118689399, 118689421, 118689422, 118689424, 118689426, 118689429, 118689431, 118689432, 118689435, 118738139, 118738150, 118738161, 118738164, 118738165, 118738168, 118738170, 118689445, 118738172, 118738173, 118689402, 118689403, 118689406, 118689407, 118689410, 118689411, 118689414, 118663205, 118689419, 118686043, 118664996, 118665000, 118695959, 118658894, 118702422, 118652311, 118652317, 118652321, 118649898, 118649900, 118649901, 118649903, 118649906, 118649907, 118647740, 118647742, 118647744, 118647747, 118645471, 118645476, 118645480) GROUP BY `battled_on`) AS from_values /*application='ShogiWeb'*/
# >>   ↳ app/models/swars/user/stat/daily_average_matches_stat.rb:45:in 'block in Swars::User::Stat::DailyAverageMatchesStat#aggregate_outcome'
# >> |----|
# >> | 34 |
# >> |----|
