<commit_before>class Issue < ActiveRecord::Base
  belongs_to :image

  def self.find_or_create_from_params(issue_params)
    unless Issue.exists?(:service_request_id => issue_params[:service_request_id])
      Issue.create(issue_params)
    else
      existing_issue = Issue.find(:service_request_id => issue_params[:service_request_id])
      existing_issue.update!(issue_params)
    end
  end

  def to_geojson
    factory = RGeo::GeoJSON::EntityFactory.instance
    issue_items = {
      status: self.status,
      create_time: self.requested_datetime.strftime("%-m-%-d-%y %I:%M%P"),
      update_time: self.updated_datetime.strftime("%-m-%-d-%y %I:%M%P")
    }
    issue_items.merge!(image_url: self.media_url) unless self.media_url.blank?

    factory.feature(self.lonlat, self.id, issue_items)
  end
end<commit_msg>only update issues if status has changed<commit_after>class Issue < ActiveRecord::Base
  belongs_to :image

  def self.find_or_create_from_params(issue_params)
    unless Issue.exists?(:service_request_id => issue_params[:service_request_id])
      Issue.create(issue_params)
    else
      existing_issue = Issue.find(:service_request_id => issue_params[:service_request_id])
      unless existing_issue.status == issue_params[:status]
        existing_issue.update!(issue_params)
      end
    end
  end

  def to_geojson
    factory = RGeo::GeoJSON::EntityFactory.instance
    issue_items = {
      status: self.status,
      create_time: self.requested_datetime.strftime("%-m-%-d-%y %I:%M%P"),
      update_time: self.updated_datetime.strftime("%-m-%-d-%y %I:%M%P")
    }
    issue_items.merge!(image_url: self.media_url) unless self.media_url.blank?

    factory.feature(self.lonlat, self.id, issue_items)
  end
end
{'fraction_non_alphanumeric': 0.12062033314187248, 'fraction_numerical': 0.0, 'mean_word_length': 4.2, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '4183356', 'n_tokens_mistral': 581, 'n_tokens_neox': 572, 'n_words': 89}