Commit 3ade633
committed
Populate sprint lookup incrementally on copy
Assigns `state.sprint_id_lookup` after each created sprint (not once
after the loop) so a mid-loop `create!` failure leaves the partial
mapping intact instead of nil, which would otherwise make copied work
packages retain the source project's sprint. Per-iteration assignment
is required because `state` is a `Hashie::Mash`: assigning the empty
hash before the loop converts it into a separate `Mash` instance, so
later mutations of the plain `Hash` are invisible to `state`. Also
strengthens the sprint-copy spec with a source/target decoupling
assertion.1 parent 380e029 commit 3ade633
2 files changed
Lines changed: 10 additions & 2 deletions
File tree
- modules/backlogs
- app/services/projects/copy
- spec/services/projects
Lines changed: 7 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
51 | 50 | | |
52 | | - | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
53 | 58 | | |
54 | 59 | | |
55 | 60 | | |
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
144 | 144 | | |
145 | 145 | | |
146 | 146 | | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
147 | 150 | | |
148 | 151 | | |
149 | 152 | | |
| |||
0 commit comments