Skip to content

Commit 994bb60

Browse files
Merge pull request #3441 from DMPRoadmap/plan-deep-copy-bug-copies-old-id-as-identifier
Fix for bug in Plan duplication results in original plan identifier b…
2 parents 96a4f59 + 747acf2 commit 994bb60

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

CHANGELOG.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
# Changelog
22

3-
## v4.2.1
4-
5-
### Fixed
3+
- 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.
64
- Fixed bar chart click function in the Usage dashboard (GitHub issue #3443)
7-
## v4.2.0
5+
86

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

app/models/plan.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,9 @@ def self.deep_copy(plan)
255255
plan_copy.title = "Copy of #{plan.title}"
256256
plan_copy.feedback_requested = false
257257
plan_copy.save!
258+
# Copy newly generated Id to the identifier
259+
plan_copy.identifier = plan_copy.id.to_s
260+
plan.save!
258261
plan.answers.each do |answer|
259262
answer_copy = Answer.deep_copy(answer)
260263
answer_copy.plan_id = plan_copy.id

0 commit comments

Comments
 (0)