diff --git a/server/app/jobs/flag_duplicate_allele_registry_ids.rb b/server/app/jobs/flag_duplicate_allele_registry_ids.rb index 6bb7ee5e1..0d5e20c33 100644 --- a/server/app/jobs/flag_duplicate_allele_registry_ids.rb +++ b/server/app/jobs/flag_duplicate_allele_registry_ids.rb @@ -10,12 +10,12 @@ def perform duplicates.each do |caid, ids| variants = Variant.where(id: ids) variants.each do |variant| - if variant.flags.select{|f| f.state == 'open' && f.comments.select{|c| c.text =~ /This Variant may be a duplicate and may need to be deprecated/ && c.user_id == 385}.count > 0}.count == 0 - Actions::FlagEntity.new( + if variant.flags.select{|f| f.state == 'open' && f.open_activity.note =~ /This Variant may be a duplicate and may need to be deprecated/ && f.open_activity.user_id == 385}.count == 0 + Activity::FlagEntity.new( flagging_user: civicbot_user, flaggable: variant, organization_id: nil, - comment: "The Allele Registry ID of this Variant is used more than once. This Variant may be a duplicate and may need to be deprecated. The following Variants all resolved to Allele Registry ID \"#{caid}\": #{ids.join(', ')}" + note: "The Allele Registry ID of this Variant is used more than once. This Variant may be a duplicate and may need to be deprecated. The following Variants all resolved to Allele Registry ID \"#{caid}\": #{ids.join(', ')}" ).perform end end diff --git a/server/app/lib/importer/disease_ontology_mirror.rb b/server/app/lib/importer/disease_ontology_mirror.rb index f0f6ee790..ff85c3b57 100644 --- a/server/app/lib/importer/disease_ontology_mirror.rb +++ b/server/app/lib/importer/disease_ontology_mirror.rb @@ -142,12 +142,12 @@ def url_from_doid(doid) def add_flags(disease, text) civicbot_user = User.find(385) (disease.evidence_items + disease.assertions).each do |obj| - if obj.flags.select{|f| f.state == 'open' && f.comments.select{|c| c.comment == text && c.user_id == 385}.count > 0}.count == 0 - Actions::FlagEntity.new( + if obj.flags.select{|f| f.state == 'open' && f.open_activity.note == text && c.open_activity.user_id == 385}.count == 0 + Activity::FlagEntity.new( flagging_user: civicbot_user, flaggable: obj, organization_id: nil, - comment: text + note: text ).perform end end diff --git a/server/app/lib/scrapers/human_phenotype_ontology.rb b/server/app/lib/scrapers/human_phenotype_ontology.rb index b68b5ee60..c703ce834 100644 --- a/server/app/lib/scrapers/human_phenotype_ontology.rb +++ b/server/app/lib/scrapers/human_phenotype_ontology.rb @@ -43,12 +43,12 @@ def self.update else civicbot_user = User.find(385) (p.evidence_items + p.assertions).each do |obj| - if obj.flags.select{|f| f.state == 'open' && f.comments.select{|c| c.text =~ /deprecated HPO term/ && c.user_id == 385}.count > 0}.count == 0 - Actions::FlagEntity.new( + if obj.flags.select{|f| f.state == 'open' && f.open_activity.note =~ /deprecated HPO term/ && f.open_activity.user_id == 385}.count == 0 + Activity::FlagEntity.new( flagging_user: civicbot_user, flaggable: obj, organization_id: nil, - comment: "This entity uses a deprecated HPO term \"#{name}\" (#{hpo_id})" + note: "This entity uses a deprecated HPO term \"#{name}\" (#{hpo_id})" ).perform end end