Skip to content

Commit

Permalink
Merge pull request #197 from identity-research-lab/fix-issue-with-ide…
Browse files Browse the repository at this point in the history
…ntity-orphans

Fix issue with identity orphans
  • Loading branch information
CoralineAda authored Dec 5, 2024
2 parents ef0528f + ec1e7e6 commit 7d131e5
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/models/identity.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def self.orphans
end

def self.reap_orphans
Identity.orphans.each(&:destroy)
query_as(:i).with('i, count{(i)-[:IDENTIFIES_WITH]-(:Persona)} AS ct').where('ct = 0').return('i, ct').map(&:first).each(&:destroy)
end

private
Expand Down
2 changes: 1 addition & 1 deletion app/models/keyword.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class Keyword
validates :name, presence: true
validates :name, uniqueness: true

has_many :in, :personas, rel_class: :ReflectsOn, dependent: :delete_orphans
has_many :in, :personas, rel_class: :ReflectsOn

# This is the prompt passed to the AI agent to serve as instructions for extracting Keywords.
PROMPT = %{
Expand Down
2 changes: 1 addition & 1 deletion app/models/response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class Response < ApplicationRecord
belongs_to :question

def codes
@codes ||= Code.where(name: self.raw_codes)
@codes ||= Code.where(name: self.raw_codes, context: self.question.context.name)
end

def sync_to_graph
Expand Down

0 comments on commit 7d131e5

Please sign in to comment.