Skip to content

Commit

Permalink
Merge pull request #3441 from DMPRoadmap/plan-deep-copy-bug-copies-ol…
Browse files Browse the repository at this point in the history
…d-id-as-identifier

Fix for bug in Plan duplication results in original plan identifier b…
  • Loading branch information
benjaminfaure authored Nov 18, 2024
2 parents 96a4f59 + 747acf2 commit 994bb60
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 2 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
# Changelog

## v4.2.1

### Fixed
- Fixed a bug in the deep copy of plans where the old identifier was being copied into the new plan. We now copy the generated id of the new plan to the identifier field.
- Fixed bar chart click function in the Usage dashboard (GitHub issue #3443)
## v4.2.0


**Note this upgrade is mainly a migration from Bootstrap 3 to Bootstrap 5.**

Expand Down
3 changes: 3 additions & 0 deletions app/models/plan.rb
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,9 @@ def self.deep_copy(plan)
plan_copy.title = "Copy of #{plan.title}"
plan_copy.feedback_requested = false
plan_copy.save!
# Copy newly generated Id to the identifier
plan_copy.identifier = plan_copy.id.to_s
plan.save!
plan.answers.each do |answer|
answer_copy = Answer.deep_copy(answer)
answer_copy.plan_id = plan_copy.id
Expand Down

0 comments on commit 994bb60

Please sign in to comment.