Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set original_combination flag for obsolete combinations with same name as its protonym script #848

Closed
jonkerz opened this issue Jan 17, 2020 · 1 comment
Labels
Milestone

Comments

@jonkerz
Copy link
Member

jonkerz commented Jan 17, 2020

Db script: http://antcat.org/database_scripts/non_original_combinations_with_same_name_as_its_protonym

@jonkerz jonkerz added the script label Jan 17, 2020
@jonkerz
Copy link
Member Author

jonkerz commented Jan 17, 2020

EDIT_SUMMARY = "Set original_combination flag for obsolete combinations with same name as its protonym, see %github848"
jonkerz = User.find(60)
Activity.execute_script_activity jonkerz, EDIT_SUMMARY

# For PaperTrail
def antcat_bot
  @antcat_bot ||= User.find(62)
end
PaperTrail.request.whodunnit = antcat_bot.id

# NonOriginalCombinationsWithSameNameAsItsProtonym
soon_original_combinations = Taxon.joins(:name, protonym: :name).
  obsolete_combinations.
  where.not(original_combination: true).
  where("names.name = names_protonyms.name")

soon_original_combinations.each do |taxon|
  taxon.update!(original_combination: true)
  taxon.create_activity :update, antcat_bot, edit_summary: EDIT_SUMMARY
end

@jonkerz jonkerz added this to the 3.2.24 milestone Jan 18, 2020
@jonkerz jonkerz closed this as completed Jan 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant