@@ -86,6 +86,7 @@ public async Task CloneTeamsAndSettingsAndBoardsAsync(Project templateProject, P
8686 foreach ( var mappedTeam in mapTeams )
8787 {
8888 await CloneTeamSettingsAsync ( templateProject . Id , project . Id , mappedTeam . Key , mappedTeam . Value ) ;
89+ await CloneTeamIterationsAsync ( templateProject . Id , project . Id , mappedTeam . Key , mappedTeam . Value ) ;
8990 await CloneTeamFieldValuesAsync ( templateProject , project , mappedTeam . Key , mappedTeam . Value ) ;
9091 await CloneBoardsAsync ( templateProject . Id , project . Id , mappedTeam . Key , mappedTeam . Value ) ;
9192 }
@@ -112,7 +113,6 @@ await Parallel.ForEachAsync(repositories.Value, async (repository, ct) =>
112113 public async Task < Dictionary < Guid , Guid > > CloneTeamsAsync ( Project templateProject , Project project )
113114 {
114115 Teams templateTeams = await _teamsService . GetTeamsAsync ( templateProject . Id ) ?? new ( ) ;
115- // TODO: TeamIterationMap
116116 return await _teamsService . CreateTeamFromTemplateAsync ( project . Id , templateTeams . Value , templateProject . DefaultTeam . Id , project . DefaultTeam . Id ) ;
117117 }
118118
@@ -171,4 +171,23 @@ await Task.WhenAll(
171171 _boardService . MoveCardStylesAsync ( projectId , projectTeamId , templateProjectId , templateTeamId , projectBoards )
172172 ) ;
173173 }
174+
175+ public async Task CloneTeamIterationsAsync ( Guid templateProjectId , Guid projectId , Guid templateTeamId , Guid projectTeamId )
176+ {
177+ var oldIterations = await _teamSettingsService . GetIterations ( projectId , projectTeamId ) ?? new ( ) ;
178+ foreach ( var iteration in oldIterations . Value )
179+ {
180+ await _teamSettingsService . DeleteIteration ( projectId , projectTeamId , iteration . Id ) ;
181+ }
182+
183+ var iterations = await _teamSettingsService . GetIterations ( templateProjectId , templateTeamId ) ?? new ( ) ;
184+ var iterationMap = await MapClassificationNodes ( templateProjectId , projectId , TreeStructureGroup . Iterations ) ;
185+ foreach ( var iteration in iterations . Value )
186+ {
187+ if ( iterationMap . TryGetValue ( iteration . Id , out var mappedIterationId ) )
188+ {
189+ await _teamSettingsService . CreateIteration ( projectId , projectTeamId , mappedIterationId ) ;
190+ }
191+ }
192+ }
174193}
0 commit comments