<commit_before>module IIDXME
  extend ActiveSupport::Concern

  included do
    def self.iidxme_async(user_id, elems)
      user = User.find_by(id: user_id)
      elems.each do |elem|
        title = gigadelic_innocentwalls(elem['data'])
        title = title_check(title)
        sheet = Sheet.find_by(title: title)
        next unless sheet
        state = reverse(elem['clear'])
        score = user.scores.find_by(sheet_id: sheet.id, version: Abilitysheet::Application.config.iidx_version)
        iidxme_params = { 'sheet_id' => sheet.id, 'state' => score.state, 'score' => elem['score'], 'bp' => elem['miss'] }
        iidxme_params['state'] = state if state < score.state
        score.update_with_logs(iidxme_params)
      end
      true
    end

    def self.title_check(e)
      return e if Sheet.exists?(title: e)
      case e
      when %(キャトられ♥恋はモ～モク) then e = %(キャトられ恋はモ～モク)
      when %(旋律のドグマ～Misérables～) then e = %(旋律のドグマ ～Misérables～)
      when %(表裏一体！？怪盗いいんちょの悩み♥) then e = %(表裏一体！？怪盗いいんちょの悩み)
      end
      e
    end

    def self.gigadelic_innocentwalls(elem)
      title = elem['title']
      return title if title != 'gigadelic' && title != 'Innocent Walls'
      title += elem['diff'] == 'sph' ? '[H]' : '[A]'
      title
    end
<commit_msg>同ランプでも更新するように変更<commit_after>module IIDXME
  extend ActiveSupport::Concern

  included do
    def self.iidxme_async(user_id, elems)
      user = User.find_by(id: user_id)
      elems.each do |elem|
        title = gigadelic_innocentwalls(elem['data'])
        title = title_check(title)
        sheet = Sheet.find_by(title: title)
        next unless sheet
        state = reverse(elem['clear'])
        score = user.scores.find_by(sheet_id: sheet.id, version: Abilitysheet::Application.config.iidx_version)
        iidxme_params = { 'sheet_id' => sheet.id, 'state' => score.state, 'score' => elem['score'], 'bp' => elem['miss'] }
        iidxme_params['state'] = state if state <= score.state
        score.update_with_logs(iidxme_params)
      end
      true
    end

    def self.title_check(e)
      return e if Sheet.exists?(title: e)
      case e
      when %(キャトられ♥恋はモ～モク) then e = %(キャトられ恋はモ～モク)
      when %(旋律のドグマ～Misérables～) then e = %(旋律のドグマ ～Misérables～)
      when %(表裏一体！？怪盗いいんちょの悩み♥) then e = %(表裏一体！？怪盗いいんちょの悩み)
      end
      e
    end

    def self.gigadelic_innocentwalls(elem)
      title = elem['title']
      return title if title != 'gigadelic' && title != 'Innocent Walls'
      title += elem['diff'] == 'sph' ? '[H]' : '[A]'
      title
    end

{'fraction_non_alphanumeric': 0.13645300825796303, 'fraction_numerical': 0.0, 'mean_word_length': 2.825563909774436, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4912099', 'n_tokens_mistral': 1015, 'n_tokens_neox': 1003, 'n_words': 194}