require "./setup"
user = Swars::User["bsplive"]
_ { Kento::Responder.new(user: user).call } # => "129.25 ms"
s { Kento::Responder.new(user: user).call }
tp Kento::Responder.new(user: user).call[:game_list]
# >>   TRANSACTION (0.4ms)  BEGIN /*application='ShogiWeb'*/
# >>   ↳ app/models/app_log.rb:103:in 'AppLog.call'
# >>   AppLog Create (1.4ms)  INSERT INTO `app_logs` (`level`, `emoji`, `subject`, `body`, `process_id`, `created_at`) VALUES ('info', '🌝', 'KENTO API', '[\"bsplive\"]', 24909, '2025-08-24 02:13:26') /*application='ShogiWeb'*/
# >>   ↳ app/models/app_log.rb:103:in 'AppLog.call'
# >>   TRANSACTION (1.1ms)  COMMIT /*application='ShogiWeb'*/
# >>   ↳ app/models/app_log.rb:103:in 'AppLog.call'
# >>   SQL (4.1ms)  SELECT DISTINCT `swars_battles`.`battled_at` AS alias_0, `swars_memberships`.`id` FROM `swars_memberships` LEFT OUTER JOIN `swars_battles` ON `swars_battles`.`id` = `swars_memberships`.`battle_id` LEFT OUTER JOIN `swars_memberships` `memberships_swars_battles` ON `memberships_swars_battles`.`battle_id` = `swars_battles`.`id` LEFT OUTER JOIN `swars_grades` ON `swars_grades`.`id` = `memberships_swars_battles`.`grade_id` LEFT OUTER JOIN `swars_users` ON `swars_users`.`id` = `memberships_swars_battles`.`user_id` LEFT OUTER JOIN `swars_rules` ON `swars_rules`.`id` = `swars_battles`.`rule_id` LEFT OUTER JOIN `judges` ON `judges`.`id` = `swars_memberships`.`judge_id` WHERE `swars_memberships`.`user_id` = 22122 ORDER BY `swars_battles`.`battled_at` DESC LIMIT 10 /*application='ShogiWeb'*/
# >>   ↳ app/models/kento/responder.rb:72:in 'Enumerable#collect'
# >>   SQL (2.8ms)  SELECT `swars_memberships`.`id` AS t0_r0, `swars_memberships`.`battle_id` AS t0_r1, `swars_memberships`.`user_id` AS t0_r2, `swars_memberships`.`grade_id` AS t0_r3, `swars_memberships`.`position` AS t0_r4, `swars_memberships`.`created_at` AS t0_r5, `swars_memberships`.`updated_at` AS t0_r6, `swars_memberships`.`grade_diff` AS t0_r7, `swars_memberships`.`think_max` AS t0_r8, `swars_memberships`.`op_user_id` AS t0_r9, `swars_memberships`.`think_last` AS t0_r10, `swars_memberships`.`think_all_avg` AS t0_r11, `swars_memberships`.`think_end_avg` AS t0_r12, `swars_memberships`.`ai_drop_total` AS t0_r13, `swars_memberships`.`judge_id` AS t0_r14, `swars_memberships`.`location_id` AS t0_r15, `swars_memberships`.`style_id` AS t0_r16, `swars_memberships`.`ek_score_without_cond` AS t0_r17, `swars_memberships`.`ek_score_with_cond` AS t0_r18, `swars_memberships`.`ai_wave_count` AS t0_r19, `swars_memberships`.`ai_two_freq` AS t0_r20, `swars_memberships`.`ai_noizy_two_max` AS t0_r21, `swars_memberships`.`ai_gear_freq` AS t0_r22, `swars_memberships`.`opponent_id` AS t0_r23, `swars_battles`.`id` AS t1_r0, `swars_battles`.`key` AS t1_r1, `swars_battles`.`battled_at` AS t1_r2, `swars_battles`.`csa_seq` AS t1_r3, `swars_battles`.`win_user_id` AS t1_r4, `swars_battles`.`turn_max` AS t1_r5, `swars_battles`.`meta_info` AS t1_r6, `swars_battles`.`created_at` AS t1_r7, `swars_battles`.`updated_at` AS t1_r8, `swars_battles`.`start_turn` AS t1_r9, `swars_battles`.`critical_turn` AS t1_r10, `swars_battles`.`sfen_body` AS t1_r11, `swars_battles`.`image_turn` AS t1_r12, `swars_battles`.`outbreak_turn` AS t1_r13, `swars_battles`.`accessed_at` AS t1_r14, `swars_battles`.`sfen_hash` AS t1_r15, `swars_battles`.`xmode_id` AS t1_r16, `swars_battles`.`preset_id` AS t1_r17, `swars_battles`.`rule_id` AS t1_r18, `swars_battles`.`final_id` AS t1_r19, `swars_battles`.`analysis_version` AS t1_r20, `swars_battles`.`starting_position` AS t1_r21, `swars_battles`.`imode_id` AS t1_r22, `memberships_swars_battles`.`id` AS t2_r0, `memberships_swars_battles`.`battle_id` AS t2_r1, `memberships_swars_battles`.`user_id` AS t2_r2, `memberships_swars_battles`.`grade_id` AS t2_r3, `memberships_swars_battles`.`position` AS t2_r4, `memberships_swars_battles`.`created_at` AS t2_r5, `memberships_swars_battles`.`updated_at` AS t2_r6, `memberships_swars_battles`.`grade_diff` AS t2_r7, `memberships_swars_battles`.`think_max` AS t2_r8, `memberships_swars_battles`.`op_user_id` AS t2_r9, `memberships_swars_battles`.`think_last` AS t2_r10, `memberships_swars_battles`.`think_all_avg` AS t2_r11, `memberships_swars_battles`.`think_end_avg` AS t2_r12, `memberships_swars_battles`.`ai_drop_total` AS t2_r13, `memberships_swars_battles`.`judge_id` AS t2_r14, `memberships_swars_battles`.`location_id` AS t2_r15, `memberships_swars_battles`.`style_id` AS t2_r16, `memberships_swars_battles`.`ek_score_without_cond` AS t2_r17, `memberships_swars_battles`.`ek_score_with_cond` AS t2_r18, `memberships_swars_battles`.`ai_wave_count` AS t2_r19, `memberships_swars_battles`.`ai_two_freq` AS t2_r20, `memberships_swars_battles`.`ai_noizy_two_max` AS t2_r21, `memberships_swars_battles`.`ai_gear_freq` AS t2_r22, `memberships_swars_battles`.`opponent_id` AS t2_r23, `swars_grades`.`id` AS t3_r0, `swars_grades`.`key` AS t3_r1, `swars_grades`.`priority` AS t3_r2, `swars_grades`.`created_at` AS t3_r3, `swars_grades`.`updated_at` AS t3_r4, `swars_users`.`id` AS t4_r0, `swars_users`.`user_key` AS t4_r1, `swars_users`.`grade_id` AS t4_r2, `swars_users`.`last_reception_at` AS t4_r3, `swars_users`.`search_logs_count` AS t4_r4, `swars_users`.`created_at` AS t4_r5, `swars_users`.`updated_at` AS t4_r6, `swars_users`.`ban_at` AS t4_r7, `swars_users`.`latest_battled_at` AS t4_r8, `swars_users`.`soft_crawled_at` AS t4_r9, `swars_users`.`hard_crawled_at` AS t4_r10, `swars_rules`.`id` AS t5_r0, `swars_rules`.`key` AS t5_r1, `swars_rules`.`position` AS t5_r2, `swars_rules`.`created_at` AS t5_r3, `swars_rules`.`updated_at` AS t5_r4, `judges`.`id` AS t6_r0, `judges`.`key` AS t6_r1, `judges`.`position` AS t6_r2, `judges`.`created_at` AS t6_r3, `judges`.`updated_at` AS t6_r4 FROM `swars_memberships` LEFT OUTER JOIN `swars_battles` ON `swars_battles`.`id` = `swars_memberships`.`battle_id` LEFT OUTER JOIN `swars_memberships` `memberships_swars_battles` ON `memberships_swars_battles`.`battle_id` = `swars_battles`.`id` LEFT OUTER JOIN `swars_grades` ON `swars_grades`.`id` = `memberships_swars_battles`.`grade_id` LEFT OUTER JOIN `swars_users` ON `swars_users`.`id` = `memberships_swars_battles`.`user_id` LEFT OUTER JOIN `swars_rules` ON `swars_rules`.`id` = `swars_battles`.`rule_id` LEFT OUTER JOIN `judges` ON `judges`.`id` = `swars_memberships`.`judge_id` WHERE `swars_memberships`.`user_id` = 22122 AND `swars_memberships`.`id` IN (122695304, 121524736, 121524739, 121499377, 121493822, 121493158, 120520558, 120520559, 120520562, 118568280) ORDER BY `swars_battles`.`battled_at` DESC /*application='ShogiWeb'*/
# >>   ↳ app/models/kento/responder.rb:72:in 'Enumerable#collect'
# >> |--------------------------------+-------------------------------------------------------------------+------------------------------------+-------------------|
# >> | tag                            | kifu_url                                                          | display_name                       | display_timestamp |
# >> |--------------------------------+-------------------------------------------------------------------+------------------------------------+-------------------|
# >> | ["将棋ウォーズ(10分)", "勝ち"] | http://localhost:3000/w/bsplive-77kma-20250427_223112.kif         | bsplive 六段 vs 77kma 三段         |        1745760672 |
# >> | ["将棋ウォーズ(10分)", "勝ち"] | http://localhost:3000/w/bsplive-yumisai-20250411_131802.kif       | bsplive 六段 vs yumisai 四段       |        1744345082 |
# >> | ["将棋ウォーズ(10分)", "勝ち"] | http://localhost:3000/w/reon4-bsplive-20250411_130521.kif         | reon4 三段 vs bsplive 六段         |        1744344321 |
# >> | ["将棋ウォーズ(10分)", "勝ち"] | http://localhost:3000/w/bsplive-taka511976-20250411_012733.kif    | bsplive 六段 vs taka511976 二段    |        1744302453 |
# >> | ["将棋ウォーズ(10分)", "勝ち"] | http://localhost:3000/w/bsplive-navisoul-20250410_230836.kif      | bsplive 六段 vs navisoul 四段      |        1744294116 |
# >> | ["将棋ウォーズ(10分)", "勝ち"] | http://localhost:3000/w/bsplive-benevolence61-20250410_225645.kif | bsplive 六段 vs benevolence61 三段 |        1744293405 |
# >> | ["将棋ウォーズ(10秒)", "負け"] | http://localhost:3000/w/Takuya2019-bsplive-20250327_200539.kif    | Takuya2019 五段 vs bsplive 七段    |        1743073539 |
# >> | ["将棋ウォーズ(10秒)", "勝ち"] | http://localhost:3000/w/bsplive-shogiboy1-20250327_195603.kif     | bsplive 七段 vs shogiboy1 五段     |        1743072963 |
# >> | ["将棋ウォーズ(10秒)", "勝ち"] | http://localhost:3000/w/DigitalHand-bsplive-20250327_193926.kif   | DigitalHand 六段 vs bsplive 七段   |        1743071966 |
# >> | ["将棋ウォーズ(3分)", "勝ち"]  | http://localhost:3000/w/bsplive-gadanaka784-20250302_194211.kif   | bsplive 八段 vs gadanaka784 六段   |        1740912131 |
# >> |--------------------------------+-------------------------------------------------------------------+------------------------------------+-------------------|
