Skip to content

Commit

Permalink
Jamie request for second round of cloning
Browse files Browse the repository at this point in the history
  • Loading branch information
brendanshean committed Jan 15, 2025
1 parent 86f31b3 commit 8656695
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
4 changes: 2 additions & 2 deletions services/QuillLMS/app/services/gen_ai/cloning_orchestrator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def run
private def evidence_activity = @evidence_activity ||= Evidence::Activity.find(evidence_activity_id)

private def evidence_research_gen_ai_activity
@evidence_research_gen_ai_activity ||= Evidence::Research::GenAI::Activity.find(evidence_research_gen_ai_activity_id)
Evidence::Research::GenAI::Activity.find_by(id: evidence_research_gen_ai_activity_id)
end

private def clone_evidence_activity
Expand Down Expand Up @@ -71,7 +71,7 @@ def run
end

private def reassign_stem_vaults(conjunction, new_prompt)
evidence_research_gen_ai_activity.stem_vaults.where(conjunction:).each do |stem_vault|
evidence_research_gen_ai_activity&.stem_vaults&.where(conjunction:)&.each do |stem_vault|
stem_vault.update!(prompt: new_prompt)
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,22 @@
it { expect { subject.run }.to change(Evidence::Label, :count).by(2) }
it { expect { subject.run }.to change(Evidence::Feedback, :count).by(2) }
it { expect { subject.run }.to change(Evidence::Highlight, :count).by(2) }

context 'when evidence_research_gen_ai_activity_id is not provided' do
let(:evidence_research_gen_ai_activity_id) { nil }

let!(:stem_vault) do
create(
:evidence_research_gen_ai_stem_vault,
conjunction: prompt.conjunction,
prompt:
)
end

it 'does not reassigns stem vaults to the new prompt' do
subject.run
expect(stem_vault.reload.prompt).not_to eq Evidence::Prompt.last
end
end
end
end

0 comments on commit 8656695

Please sign in to comment.