require "./setup"
_ { QuickScript::Swars::PrisonSearchScript.new(query: "九").call[:rows].size } # => "132.02 ms"
QuickScript::Swars::PrisonSearchScript.new(query: "九").call[:rows].size       # => 4
s { tp QuickScript::Swars::PrisonSearchScript.new(query: "九").call[:rows] } # => [{"名前"=>{:_link_to=>{:name=>"P_qui", :url=>"https://shogiwars.heroz.jp/users/mypage/P_qui"}}, "段位"=>"九段", "発見"=>"2024-05-16", ""=>{:_nuxt_link=>{:name=>"棋譜(0)", :to=>{:name=>"swars-search", :query=>{:query=>"P_qui", :page=>1}}}}}, {"名前"=>{:_link_to=>{:name=>"rattter", :url=>"https://shogiwars.heroz.jp/users/mypage/rattter"}}, "段位"=>"九段", "発見"=>"2024-05-16", ""=>{:_nuxt_link=>{:name=>"棋譜(11)", :to=>{:name=>"swars-search", :query=>{:query=>"rattter", :page=>1}}}}}, {"名前"=>{:_link_to=>{:name=>"ratingcow", :url=>"https://shogiwars.heroz.jp/users/mypage/ratingcow"}}, "段位"=>"九段", "発見"=>"2024-01-16", ""=>{:_nuxt_link=>{:name=>"棋譜(0)", :to=>{:name=>"swars-search", :query=>{:query=>"ratingcow", :page=>1}}}}}, {"名前"=>{:_link_to=>{:name=>"baimnionh", :url=>"https://shogiwars.heroz.jp/users/mypage/baimnionh"}}, "段位"=>"九段", "発見"=>"2024-01-16", ""=>{:_nuxt_link=>{:name=>"棋譜(0)", :to=>{:name=>"swars-search", :query=>{:query=>"baimnionh", :page=>1}}}}}]
# >>   SQL (10.3ms)  SELECT DISTINCT `swars_users`.`ban_at` AS alias_0, `swars_users`.`id` FROM `swars_users` INNER JOIN `swars_grades` ON `swars_grades`.`id` = `swars_users`.`grade_id` LEFT OUTER JOIN `swars_memberships` ON `swars_memberships`.`user_id` = `swars_users`.`id` WHERE `swars_users`.`ban_at` IS NOT NULL AND (LOWER(swars_users.user_key) LIKE '%九%' OR `swars_grades`.`key` LIKE '%九%') ORDER BY `swars_users`.`ban_at` DESC LIMIT 500 OFFSET 0
# >>   ↳ app/models/quick_script/swars/prison_search_script.rb:35:in `collect'
# >>   SQL (0.4ms)  SELECT `swars_users`.`id` AS t0_r0, `swars_users`.`user_key` AS t0_r1, `swars_users`.`grade_id` AS t0_r2, `swars_users`.`last_reception_at` AS t0_r3, `swars_users`.`search_logs_count` AS t0_r4, `swars_users`.`created_at` AS t0_r5, `swars_users`.`updated_at` AS t0_r6, `swars_users`.`ban_at` AS t0_r7, `swars_users`.`latest_battled_at` AS t0_r8, `swars_grades`.`id` AS t1_r0, `swars_grades`.`key` AS t1_r1, `swars_grades`.`priority` AS t1_r2, `swars_grades`.`created_at` AS t1_r3, `swars_grades`.`updated_at` AS t1_r4, `swars_memberships`.`id` AS t2_r0, `swars_memberships`.`battle_id` AS t2_r1, `swars_memberships`.`user_id` AS t2_r2, `swars_memberships`.`grade_id` AS t2_r3, `swars_memberships`.`position` AS t2_r4, `swars_memberships`.`created_at` AS t2_r5, `swars_memberships`.`updated_at` AS t2_r6, `swars_memberships`.`grade_diff` AS t2_r7, `swars_memberships`.`think_max` AS t2_r8, `swars_memberships`.`op_user_id` AS t2_r9, `swars_memberships`.`think_last` AS t2_r10, `swars_memberships`.`think_all_avg` AS t2_r11, `swars_memberships`.`think_end_avg` AS t2_r12, `swars_memberships`.`ai_drop_total` AS t2_r13, `swars_memberships`.`judge_id` AS t2_r14, `swars_memberships`.`location_id` AS t2_r15, `swars_memberships`.`style_id` AS t2_r16, `swars_memberships`.`ek_score_without_cond` AS t2_r17, `swars_memberships`.`ek_score_with_cond` AS t2_r18, `swars_memberships`.`ai_wave_count` AS t2_r19, `swars_memberships`.`ai_two_freq` AS t2_r20, `swars_memberships`.`ai_noizy_two_max` AS t2_r21, `swars_memberships`.`ai_gear_freq` AS t2_r22 FROM `swars_users` INNER JOIN `swars_grades` ON `swars_grades`.`id` = `swars_users`.`grade_id` LEFT OUTER JOIN `swars_memberships` ON `swars_memberships`.`user_id` = `swars_users`.`id` WHERE `swars_users`.`ban_at` IS NOT NULL AND (LOWER(swars_users.user_key) LIKE '%九%' OR `swars_grades`.`key` LIKE '%九%') AND `swars_users`.`id` IN (909156, 901187, 842454, 455567) ORDER BY `swars_users`.`ban_at` DESC
# >>   ↳ app/models/quick_script/swars/prison_search_script.rb:35:in `collect'
# >> |----------------------------------------------------------------------------------------------+------+------------+----------------------------------------------------------------------------------------------------------|
# >> | 名前                                                                                         | 段位 | 発見       |                                                                                                          |
# >> |----------------------------------------------------------------------------------------------+------+------------+----------------------------------------------------------------------------------------------------------|
# >> | {:_link_to=>{:name=>"P_qui", :url=>"https://shogiwars.heroz.jp/users/mypage/P_qui"}}         | 九段 | 2024-05-16 | {:_nuxt_link=>{:name=>"棋譜(0)", :to=>{:name=>"swars-search", :query=>{:query=>"P_qui", :page=>1}}}}     |
# >> | {:_link_to=>{:name=>"rattter", :url=>"https://shogiwars.heroz.jp/users/mypage/rattter"}}     | 九段 | 2024-05-16 | {:_nuxt_link=>{:name=>"棋譜(11)", :to=>{:name=>"swars-search", :query=>{:query=>"rattter", :page=>1}}}}  |
# >> | {:_link_to=>{:name=>"ratingcow", :url=>"https://shogiwars.heroz.jp/users/mypage/ratingcow"}} | 九段 | 2024-01-16 | {:_nuxt_link=>{:name=>"棋譜(0)", :to=>{:name=>"swars-search", :query=>{:query=>"ratingcow", :page=>1}}}} |
# >> | {:_link_to=>{:name=>"baimnionh", :url=>"https://shogiwars.heroz.jp/users/mypage/baimnionh"}} | 九段 | 2024-01-16 | {:_nuxt_link=>{:name=>"棋譜(0)", :to=>{:name=>"swars-search", :query=>{:query=>"baimnionh", :page=>1}}}} |
# >> |----------------------------------------------------------------------------------------------+------+------------+----------------------------------------------------------------------------------------------------------|
