<commit_before>require 'securerandom'

hospitals = [{:id => 1, :name => 'Sankara Rural Eye Hospital', :surgeries => 15000, :city => "Krishnankoil", :state => "Tamil Nadu", :building_status => "Completed", :contact => "<EMAIL>", :story => "This is the story of The Sankara Rural Eye Hospital", :lat => 9.565389, :lng =>77.688760, :status => true},
            {:id => 2, :name => 'Sankara Eye Hospital', :surgeries => 10000, :city => "Ludhiana", :state => "Punjab", :building_status => "Completed", :contact => "<EMAIL>", :story => "This is the story of The Sankara Eye Hospital", :lat =>30.861098, :lng => 75.704154, :status => true},
            {:id => 3, :name => 'Bangalore Hospital', :surgeries => 134546, :city => "Bengaluru", :state => "Karnataka", :building_status => "Completed", :contact => "<EMAIL>", :story => "This is the story of The Bangalore Hospitall", :lat => 12.957378, :lng => 77.712852, :status => true},
            {:id => 4, :name => 'Sankara Eye Hospital, Guntur', :surgeries => 25000, :city => "Guntur", :state => "Andhra Pradesh", :building_status => "Completed", :contact => "<EMAIL>", :story => "This is the story of The Sankara Eye Hospital, Guntur", :lat => 16.350630, :lng => 80.49328, :status => true},
            {:id => 5, :name => 'Shimoga Hospital', :surgeries => 89307, :city => "Shimoga", :state => "Karnataka", :building_status => "Completed", :contact => "<EMAIL>", :story => "This is the story of The Shimoga Hospital", :lat => 13.904054, :lng => 75.560752, :status => true}
  ]

hospitals.each do |hospital|
  if not Hospital.exists?(hospital[:id])
    Hospital.create!(hospital)
  elsif Hospital.find(hospital[:id]).status.nil?
    h = Hospital.find(hospital[:id])
    h.update(status: hospital[:status])
  end
end

donors = [{:id => 1, :first_name => 'Aaron', :last_name => 'Rowell', :email => '<EMAIL>', :phone => '806-278-5037', :status => true},
        {:id => 2, :first_name => 'Mary', :last_name => 'Wilson', :email => '<EMAIL>', :phone => '847-509-8591', :status => true},
        {:id => 3, :first_name => 'Richard', :last_name => 'Krantz', :email => '<EMAIL>', :phone => '503-616-7352', :status => true},
        {:id => 4, :first_name => 'Sandra', :last_name => 'Railey', :email => '<EMAIL>', :phone => '510-992-1438', :status => true},
        {:id => 5, :first_name => 'Ilana', :last_name => 'Miranda', :email => '<EMAIL>', :phone => '206-234-2513', :status => true},
        {:id => 6, :first_name => 'Teresa', :last_name => 'Bahr', :email => '<EMAIL>', :phone => '773-718-0267', :status => true},
        {:id => 7, :first_name => 'Dennis', :last_name => 'Gain', :email => '<EMAIL>', :phone => '630-922-7498', :status => true},
        {:id => 8, :first_name => 'Grace', :last_name => 'Wright', :email => '<EMAIL>', :phone => '502-301-1405', :status => true},
        {:id => 9, :first_name => 'Kevin', :last_name => 'Curry', :email => '<EMAIL>', :phone => '415-338-8924', :status => true},
        {:id => 10, :first_name => 'Kobe', :last_name => 'James', :email => '<EMAIL>', :phone => '639-671-3451', :status => true}
  	 ]

donors.each do |donor|
  donor[:secret] = SecureRandom.urlsafe_base64
  if not Donor.exists?(donor[:id])
    Donor.create!(donor)
  elsif Donor.find(donor[:id]).status.nil?
    d = Donor.find(donor[:id])
    d.update(status: donor[:status])
  end
end

dedications = [{:id => 1, :dedication => 'No more blindness!', :status => true, :hospital_id => 2, :donor_id => 6, :tier => 'Gold', :published => true},
            {:id => 2, :dedication => 'For the kids', :status => true, :hospital_id => 2, :donor_id => 1, :tier => 'Platinum', :published => true},
            {:id => 3, :dedication => 'Dedicated to my family', :status => true, :hospital_id => 2, :donor_id => 3, :tier => 'Silver', :published => true},
            {:id => 4, :dedication => 'Keep up the good work', :status => true, :hospital_id => 1, :donor_id => 2, :tier => 'Gold', :published => true},
            {:id => 5, :dedication => '20/20 for all', :status => true, :hospital_id => 1, :donor_id => 4, :tier => 'Gold', :published => true},
            {:id => 6, :dedication => 'Go Sankara!', :status => true, :hospital_id => 3, :donor_id => 5, :tier => "Platinum", :published => false},
            {:id => 7, :dedication => 'Keep it up!', :status => true, :hospital_id => 3, :donor_id => 1, :tier => "Silver", :published => false},
            {:id => 8, :dedication => 'My favorite charity!', :status => true, :hospital_id => 4, :donor_id => 7, :tier => "Gold", :published => false},
            {:id => 9, :dedication => 'Happy to help a great cause', :status => true, :hospital_id => 5, :donor_id => 8, :tier => "Platinum", :published => false},
            {:id => 10, :dedication => 'Keep funding', :status => true, :hospital_id => 4, :donor_id => 9, :tier => "Silver", :published => false},
            {:id => 11, :dedication => 'I love Sankara', :status => false, :hospital_id => 1, :donor_id => 8, :tier => "Platinum", :published => true},
            {:id => 12, :dedication => 'I hate blindness!', :status => true, :hospital_id => 5, :donor_id => 10, :tier => "Gold", :published => false},
            {:id => 13, :hospital_id => 1, :donor_id => 2, :tier => "Silver", :published => false},
            {:id => 14, :hospital_id => 1, :donor_id => 3, :tier => "Silver", :published => false}
  	 ]

dedications.each do |dedication|
  if not Dedication.exists?(dedication[:id])
    Dedication.create!(dedication)
  elsif Dedication.find(dedication[:id]).status.nil?
    d = Dedication.find(dedication[:id])
    d.update(status: dedication[:status])
  elsif Dedication.find(dedication[:id]).published.nil?
    d = Dedication.find(dedication[:id])
    d.update(published: dedication[:published])
  end
end
<commit_msg>adding secret to existing donors<commit_after>require 'securerandom'

hospitals = [{:id => 1, :name => 'Sankara Rural Eye Hospital', :surgeries => 15000, :city => "Krishnankoil", :state => "Tamil Nadu", :building_status => "Completed", :contact => "<EMAIL>", :story => "This is the story of The Sankara Rural Eye Hospital", :lat => 9.565389, :lng =>77.688760, :status => true},
            {:id => 2, :name => 'Sankara Eye Hospital', :surgeries => 10000, :city => "Ludhiana", :state => "Punjab", :building_status => "Completed", :contact => "<EMAIL>", :story => "This is the story of The Sankara Eye Hospital", :lat =>30.861098, :lng => 75.704154, :status => true},
            {:id => 3, :name => 'Bangalore Hospital', :surgeries => 134546, :city => "Bengaluru", :state => "Karnataka", :building_status => "Completed", :contact => "<EMAIL>", :story => "This is the story of The Bangalore Hospitall", :lat => 12.957378, :lng => 77.712852, :status => true},
            {:id => 4, :name => 'Sankara Eye Hospital, Guntur', :surgeries => 25000, :city => "Guntur", :state => "Andhra Pradesh", :building_status => "Completed", :contact => "<EMAIL>", :story => "This is the story of The Sankara Eye Hospital, Guntur", :lat => 16.350630, :lng => 80.49328, :status => true},
            {:id => 5, :name => 'Shimoga Hospital', :surgeries => 89307, :city => "Shimoga", :state => "Karnataka", :building_status => "Completed", :contact => "<EMAIL>", :story => "This is the story of The Shimoga Hospital", :lat => 13.904054, :lng => 75.560752, :status => true}
  ]

hospitals.each do |hospital|
  if not Hospital.exists?(hospital[:id])
    Hospital.create!(hospital)
  elsif Hospital.find(hospital[:id]).status.nil?
    h = Hospital.find(hospital[:id])
    h.update(status: hospital[:status])
  end
end

donors = [{:id => 1, :first_name => 'Aaron', :last_name => 'Rowell', :email => '<EMAIL>', :phone => '806-278-5037', :status => true},
        {:id => 2, :first_name => 'Mary', :last_name => 'Wilson', :email => '<EMAIL>', :phone => '847-509-8591', :status => true},
        {:id => 3, :first_name => 'Richard', :last_name => 'Krantz', :email => '<EMAIL>', :phone => '503-616-7352', :status => true},
        {:id => 4, :first_name => 'Sandra', :last_name => 'Railey', :email => '<EMAIL>', :phone => '510-992-1438', :status => true},
        {:id => 5, :first_name => 'Ilana', :last_name => 'Miranda', :email => '<EMAIL>', :phone => '206-234-2513', :status => true},
        {:id => 6, :first_name => 'Teresa', :last_name => 'Bahr', :email => '<EMAIL>', :phone => '773-718-0267', :status => true},
        {:id => 7, :first_name => 'Dennis', :last_name => 'Gain', :email => '<EMAIL>', :phone => '630-922-7498', :status => true},
        {:id => 8, :first_name => 'Grace', :last_name => 'Wright', :email => '<EMAIL>', :phone => '502-301-1405', :status => true},
        {:id => 9, :first_name => 'Kevin', :last_name => 'Curry', :email => '<EMAIL>', :phone => '415-338-8924', :status => true},
        {:id => 10, :first_name => 'Kobe', :last_name => 'James', :email => '<EMAIL>', :phone => '639-671-3451', :status => true}
  	 ]

donors.each do |donor|
  donor[:secret] = SecureRandom.urlsafe_base64
  if not Donor.exists?(donor[:id])
    Donor.create!(donor)
  elsif Donor.find(donor[:id]).status.nil?
    d = Donor.find(donor[:id])
    d.update(status: donor[:status])
  elsif Donor.find(donor[:id]).secret.nil?
    d = Donor.find(donor[:id])
    d.update(secret: donor[:secret])
  end
end

dedications = [{:id => 1, :dedication => 'No more blindness!', :status => true, :hospital_id => 2, :donor_id => 6, :tier => 'Gold', :published => true},
            {:id => 2, :dedication => 'For the kids', :status => true, :hospital_id => 2, :donor_id => 1, :tier => 'Platinum', :published => true},
            {:id => 3, :dedication => 'Dedicated to my family', :status => true, :hospital_id => 2, :donor_id => 3, :tier => 'Silver', :published => true},
            {:id => 4, :dedication => 'Keep up the good work', :status => true, :hospital_id => 1, :donor_id => 2, :tier => 'Gold', :published => true},
            {:id => 5, :dedication => '20/20 for all', :status => true, :hospital_id => 1, :donor_id => 4, :tier => 'Gold', :published => true},
            {:id => 6, :dedication => 'Go Sankara!', :status => true, :hospital_id => 3, :donor_id => 5, :tier => "Platinum", :published => false},
            {:id => 7, :dedication => 'Keep it up!', :status => true, :hospital_id => 3, :donor_id => 1, :tier => "Silver", :published => false},
            {:id => 8, :dedication => 'My favorite charity!', :status => true, :hospital_id => 4, :donor_id => 7, :tier => "Gold", :published => false},
            {:id => 9, :dedication => 'Happy to help a great cause', :status => true, :hospital_id => 5, :donor_id => 8, :tier => "Platinum", :published => false},
            {:id => 10, :dedication => 'Keep funding', :status => true, :hospital_id => 4, :donor_id => 9, :tier => "Silver", :published => false},
            {:id => 11, :dedication => 'I love Sankara', :status => false, :hospital_id => 1, :donor_id => 8, :tier => "Platinum", :published => true},
            {:id => 12, :dedication => 'I hate blindness!', :status => true, :hospital_id => 5, :donor_id => 10, :tier => "Gold", :published => false},
            {:id => 13, :hospital_id => 1, :donor_id => 2, :tier => "Silver", :published => false},
            {:id => 14, :hospital_id => 1, :donor_id => 3, :tier => "Silver", :published => false}
  	 ]

dedications.each do |dedication|
  if not Dedication.exists?(dedication[:id])
    Dedication.create!(dedication)
  elsif Dedication.find(dedication[:id]).status.nil?
    d = Dedication.find(dedication[:id])
    d.update(status: dedication[:status])
  elsif Dedication.find(dedication[:id]).published.nil?
    d = Dedication.find(dedication[:id])
    d.update(published: dedication[:published])
  end
end

{'fraction_non_alphanumeric': 0.22506415739948674, 'fraction_numerical': 0.046877673224978614, 'mean_word_length': 3.845006216328222, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 451, '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': '703121', 'n_tokens_mistral': 4559, 'n_tokens_neox': 4034, 'n_words': 1122}