require "./setup"
# _ { Swars::User["SugarHuuko"].stat(sample_max: 1000).vitality_stat.vital_ratio } # => "127.57 ms"
# s { Swars::User["SugarHuuko"].stat(sample_max: 1000).vitality_stat.vital_ratio } # => 0.0

sql
Swars::User["SugarHuuko"].stat(sample_max: 1000).vitality_stat.win_only.to_a # => []

# >>   Swars::User Load (0.7ms)  SELECT `swars_users`.* FROM `swars_users` WHERE `swars_users`.`user_key` = 'SugarHuuko' LIMIT 1 /*application='ShogiWeb'*/
# >>   ↳ app/models/swars/user.rb:45:in 'Swars::User.[]'
# >>   Swars::Membership Ids (14.1ms)  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 1000 /*application='ShogiWeb'*/
# >>   ↳ app/models/swars/user/stat/scope_ext.rb:31:in 'Swars::User::Stat::ScopeExt#scope_ids'
# >>   Swars::Membership Load (3.8ms)  SELECT `swars_memberships`.* FROM `swars_memberships` INNER JOIN `swars_battles` ON `swars_battles`.`id` = `swars_memberships`.`battle_id` INNER JOIN `judges` ON `judges`.`id` = `swars_memberships`.`judge_id` WHERE `swars_memberships`.`id` IN (128141870, 128141873, 128141874, 128141876, 128141879, 128141880, 128141883, 128015255, 128015258, 128015259, 128015261, 128015263, 128015265, 128015267, 128015270, 128015271, 128015273, 128015276, 128015280, 128015284, 128015286, 128015242, 128005819, 128015243, 128015245, 128015248, 128015249, 128015252, 128015254, 128001335, 128001336, 128001338, 128001341, 128001342, 128001345, 128001346, 128001349, 128001350, 127823018, 127823020, 127805035, 127364566, 127364568, 127364570, 127364574, 127364575, 127364577, 127364580, 127364582, 127364584, 127364585, 127404258, 127364589, 127364591, 127364594, 127364596, 127364598, 127364599, 127364602, 127364604, 127364606, 127364607, 127397299, 127397301, 127397304, 127397306, 127397308, 127397309, 127397318, 127397327, 127397335, 127397339, 127245829, 127245831, 127245834, 127245836, 127245837, 127232620, 127231540, 127245839, 127245841, 127272966, 127272967, 127229579, 127229580, 127226332, 127229583, 127225676, 127229584, 127229586, 127229589, 127229590, 127272970, 127272972, 127272974, 127272976, 127272977, 127272979, 127272981, 127229592, 127229594, 127229597, 127229598, 127229600, 127229602, 127229605, 127229606, 127229608, 127229611, 127210268, 127210270, 127175162, 127175166, 127175167, 127175171, 127175175, 127175180, 127175184, 127175187, 127175191, 127148600, 127272983, 127146857, 127139471, 127129219, 127129220, 127129223, 127129225, 127047993, 127047995, 127047997, 127047998, 126887249, 126887250, 126887253, 126887254, 126887257, 126868886, 126868888, 126868891, 126868893, 126868894, 126868897, 126868899, 126868903, 126868906, 126868910, 126868917, 126868918, 126868921, 126868922, 126868925, 126868926, 126868929, 127210272, 127210275, 127210277, 127210278, 126882870, 127210281, 127210282, 126801429, 126801430, 126801432, 126801434, 126801437, 126801438, 126801441, 126801442, 126801445, 126801446, 126774707, 127210284, 127210286, 126824049, 127210289, 127210291, 127210292, 127210294, 127210297, 127210298, 127210300, 127210303, 127210305, 126570401, 126570403, 126570406, 126570408, 126570410, 126570412, 126570414, 126570416, 126570417, 126570419, 126570421, 126570423, 126570426, 126440626, 126440627, 126440629, 126440635, 126440637, 126440641, 126440643, 126428320, 126440645, 126106175, 126106179, 126106182, 125806785, 125806786, 125806788, 125800683, 125806790, 125806793, 125802019, 125806794, 125806796, 125806799, 125806801, 125806803, 125806805, 125797175, 125796531, 125796533, 125796537, 125796543, 125796545, 125796547, 125792465, 125792466, 125792446, 125792448, 125780412, 125792450, 125792452, 125792455, 125792456, 125792458, 125792461, 125792462, 125699753, 125699755, 125668640, 125668642, 125668645, 125668646, 125668649, 125660991, 125634412, 125634415, 125634417, 125395568, 125395570, 125395573, 125314460, 125314463, 125186355, 125186357, 125186359, 125181104, 125179954, 125176035, 124946230, 124946232, 124946235, 124851968, 124851970, 124851972, 124851975, 124797421, 124788402, 124815072, 124815074, 124815076, 124815078, 124815080, 124815081, 124815084, 124815086, 124815148, 124797790, 124839815, 124768400, 124765104, 124768407, 124765240, 124768413, 124768420, 124738095, 124738097, 124672521, 124672524, 124669580, 124672526, 124672527, 124620084, 124620089, 124595200, 124595201, 124595206, 124595208, 124595211, 124584980, 124584992, 124584981, 124584985, 124584988, 124584990, 124520905, 124524027, 124524030, 124524034, 124517654, 124524038, 124524043, 124524046, 124517106, 124509767, 124317861, 124317100, 124317102, 124317105, 124317106, 124315754, 124317109, 124317110, 124317112, 124317120, 124317125, 124342764, 124360979, 124342772, 124317090, 124317091, 125113335, 124317098, 123483596, 123473010, 123473012, 123472959, 123472962, 123472963, 123472966, 123472970, 123472973, 123472977, 123472985, 123472988, 123473005, 123365137, 123365139, 123365141, 123365144, 123365147, 123361471, 123361474, 123360621, 123361478, 123361479, 123361482, 123361484, 123361485, 123361488, 123358490, 123361489, 123361491, 123361494, 123361496, 123361498, 123361500, 123361502, 123361504, 123361506, 123361507, 123361509, 123361512, 123361514, 123361516, 123361517, 123361520, 123361521, 123361524, 123361525, 123361469, 123341089, 123341092, 123321595, 123341095, 122857115, 122857117, 122592622, 122585046, 122585048, 122585051, 122585052, 122585055, 122585057, 122585059, 122585060, 122581943, 122633269, 122633271, 122633272, 122474572, 122423796, 122423798, 122423799, 122423802, 122423804, 122423806, 122423807, 122423810, 122423811, 122423814, 122423816, 122423817, 122423819, 122337405, 122337406, 122337409, 122313322, 122283406, 122283407, 122283409, 122212096, 122212104, 122212111, 122212114, 122212116, 122212117, 122212120, 122212122, 122212124, 122212125, 122212128, 122212130, 122212139, 122191645, 121718858, 121718862, 120925759, 120925760, 120826747, 120826749, 120826750, 120826756, 120826758, 120826763, 120826764, 120826766, 120826770, 120826772, 122212147, 120810901, 120810902, 120741118, 120741120, 120741129, 120741131, 120440326, 119900895, 119807770, 119807773, 119807776, 119804141, 119807771, 118689424, 118689435, 118738150, 118689445, 118689406, 118689407, 118686043, 118908877, 118647740, 118304326, 118304193, 118304195, 118304197, 118304199, 118304200, 118304202, 118304204, 117766542, 117605804, 117577640, 117126163, 116118852, 116105895, 116105908, 116105894, 116105914, 115423856, 115423859, 115390832, 115390847, 115249052, 115181900, 115204844, 115125187, 115125141, 114908311, 114908323, 114718589, 114407919, 114407924, 113830896, 113750815, 113654634, 113153914, 113153915, 113153918, 113153919, 112448459, 112358744, 112358747, 112358749, 112260580, 111262067, 111262070, 111262072, 111254756, 111254758, 111202143, 111166667, 108835638, 108612069, 108612071, 108272952, 108272871, 108272872, 108257604, 107789817, 107717112, 107492224, 107492226, 107096990, 106962984, 106584993, 106576344, 106576377, 106188157, 106188158, 106188162, 106188171, 105893045, 105362667, 105362675, 105362678, 105362693, 105310989, 105310990, 105310993, 105310981, 105310995, 105310997, 105310985, 105310987, 105274216, 105274219, 105274228, 105274235, 105274236, 105274239, 105274240, 105274242, 105187393, 105181183, 105181185, 104957073, 104774975, 104774969, 104701261, 104701263, 104422750, 104422751, 104365240, 103900687, 103865435, 103862771, 103843883, 103838349, 103602867, 103054052, 102745004, 102569431, 102569433, 102569434, 101470135, 101470137, 100171958, 100171960, 100171962, 100171964, 100171965, 100171976, 100015085, 100015087, 100015089, 100015091, 100009154, 100009157, 100007479, 100007489, 100007493, 100007495, 100007498, 100003389, 100003392, 100003397, 100003411, 100003416, 99994325, 99994327, 99679774, 99679777, 99675797, 99613479, 99570919, 99570920, 99570923, 99570925, 99570927, 99570929, 99570930, 99570932, 99570935, 99570937, 99562447, 99561483, 99561485, 99049425, 98963461, 98963326, 98819106, 97904492, 97870884, 97233768, 96914486, 96733128, 96733144, 96733160, 96733164, 96733167, 96709701, 96709707, 96701900, 95799625, 95799626, 95799629, 95405180, 95405184, 95071691, 94671316, 94671318, 93630834, 89620822, 89620824, 89204461, 89204463, 89204466, 89204467, 85483125, 85483127, 85453090, 85453092, 85453093, 85453095, 85453097, 84122973, 84122976, 84122978, 83959220, 83959222, 83959225, 83959227, 83959228, 83959232, 83959235, 83951483, 83951485, 83951487, 80388156, 79496476, 78060308, 78052924, 78052926, 78052929, 78052930, 77745566, 76390441, 75713080, 69013710, 67509002, 67509004, 67509006, 67509009, 67509010, 67509012, 67509015, 67509017, 66327055, 66327057, 66327059, 66327060, 66327063, 66327065, 66327070, 66327072, 66327075, 66327076, 66327067, 64513057, 64513061, 64513062, 64513065, 64513066, 64513069, 64513070, 64513072, 64513074, 64273045, 62999980, 61525874, 59420089, 58680496, 58680506, 58680520, 58680531, 58419627, 58419629, 58413556, 58411170, 58363901, 58363903, 58363905, 58363907, 58363909, 58363912, 58363913, 58363915, 58113923, 58113929, 58113932, 58113936, 58113942, 58108395, 58014994, 58014996, 57990826, 51770733, 51245511, 51214938, 50674990, 50674992, 50640204, 50640206, 50640208, 50640209, 50640194, 50640197, 50612967, 50612968, 50618803, 50612988, 50550374, 50550376, 50545997, 50545858, 50545768, 50545649, 50384303, 50384305, 50384310, 50384312, 50384313, 50384316, 50384319, 50384322, 50384323, 50550378, 50550380, 50550382, 50355671, 50355674, 50355675, 50161415, 50161418, 50140920, 50140924, 50140926, 50140930, 50121694, 50121695, 50121698, 50099445, 50099447, 50099450, 50099451, 50099455, 49953914, 49874900, 49874903, 49863179, 49863180, 49863182, 49014723, 49014485, 49014489, 49014492, 49014495, 48912937, 48908203, 48480703, 48480705, 48465080, 48465082, 48008801, 48008802, 48008804, 48008806, 46921207, 46921211, 46921216, 46921220, 45976640, 45976643, 44842057, 44842059, 44322912, 44278048, 44278050, 44271896, 44271898, 44271900, 44268359, 111715900, 44037888, 44037890, 44037891, 44037893, 44037896, 43807663, 43807668, 43807669, 43807671, 43753523, 43550943, 43550952, 18209649) AND `swars_battles`.`battled_at` >= '2025-08-12 00:26:31' AND `judges`.`key` = 'win' /*application='ShogiWeb'*/
