@@ -1111,6 +1111,7 @@ public async Task<IActionResult> Import(ImportMapRotationsViewModel model, Cance
11111111 {
11121112 Index = i ,
11131113 Title = rotation . Title ,
1114+ Description = rotation . RawComment ?? "" ,
11141115 GameMode = rotation . GameMode ,
11151116 MapCount = rotation . MapNames . Count ,
11161117 MapNames = rotation . MapNames ,
@@ -1186,13 +1187,16 @@ public async Task<IActionResult> ImportConfirm(ImportMapRotationsConfirmViewMode
11861187 return authResult ;
11871188
11881189 var selectedIndices = new HashSet < int > ( model . SelectedIndices ) ;
1189- var selectedRotations = draft . Rotations
1190+ var editLookup = model . Edits
1191+ . Where ( e => e != null )
1192+ . ToDictionary ( e => e . Index , e => e ) ;
1193+ var prefix = model . ImportPrefix ? . Trim ( ) ?? "" ;
1194+ var selectedRotationsWithIndex = draft . Rotations
11901195 . Select ( ( r , i ) => ( Rotation : r , Index : i ) )
11911196 . Where ( x => selectedIndices . Contains ( x . Index ) )
1192- . Select ( x => x . Rotation )
11931197 . ToList ( ) ;
11941198
1195- if ( selectedRotations . Count == 0 )
1199+ if ( selectedRotationsWithIndex . Count == 0 )
11961200 {
11971201 this . AddAlertWarning ( "No rotations selected for import." ) ;
11981202 return RedirectToAction ( nameof ( Import ) ) ;
@@ -1219,7 +1223,7 @@ public async Task<IActionResult> ImportConfirm(ImportMapRotationsConfirmViewMode
12191223 }
12201224
12211225 // Step 2: Resolve ALL map names to GUIDs (always re-resolve after creation attempt)
1222- var allMapNames = selectedRotations . SelectMany ( r => r . MapNames ) . Distinct ( StringComparer . OrdinalIgnoreCase ) . ToArray ( ) ;
1226+ var allMapNames = selectedRotationsWithIndex . SelectMany ( x => x . Rotation . MapNames ) . Distinct ( StringComparer . OrdinalIgnoreCase ) . ToArray ( ) ;
12231227 var mapLookup = new Dictionary < string , Guid > ( StringComparer . OrdinalIgnoreCase ) ;
12241228
12251229 for ( var skip = 0 ; skip < allMapNames . Length ; skip += 100 )
@@ -1241,7 +1245,7 @@ public async Task<IActionResult> ImportConfirm(ImportMapRotationsConfirmViewMode
12411245 // Step 3: Create rotations
12421246 var results = new List < ImportResultItem > ( ) ;
12431247
1244- foreach ( var rotation in selectedRotations )
1248+ foreach ( var ( rotation , rotationIndex ) in selectedRotationsWithIndex )
12451249 {
12461250 try
12471251 {
@@ -1262,9 +1266,24 @@ public async Task<IActionResult> ImportConfirm(ImportMapRotationsConfirmViewMode
12621266 continue ;
12631267 }
12641268
1265- var createDto = new CreateMapRotationDto ( draft . GameType , rotation . Title , rotation . GameMode )
1269+ // Apply user edits (title/description) and prefix
1270+ var title = rotation . Title ;
1271+ var description = rotation . RawComment ;
1272+ if ( editLookup . TryGetValue ( rotationIndex , out var edit ) )
12661273 {
1267- Description = rotation . RawComment ,
1274+ if ( ! string . IsNullOrWhiteSpace ( edit . Title ) )
1275+ title = edit . Title . Trim ( ) ;
1276+ description = edit . Description ? . Trim ( ) ;
1277+ }
1278+
1279+ if ( ! string . IsNullOrEmpty ( prefix ) && ! title . StartsWith ( prefix , StringComparison . OrdinalIgnoreCase ) )
1280+ {
1281+ title = $ "{ prefix } — { title } ";
1282+ }
1283+
1284+ var createDto = new CreateMapRotationDto ( draft . GameType , title , rotation . GameMode )
1285+ {
1286+ Description = description ,
12681287 MapIds = mapIds
12691288 } ;
12701289
@@ -1275,7 +1294,7 @@ public async Task<IActionResult> ImportConfirm(ImportMapRotationsConfirmViewMode
12751294 {
12761295 results . Add ( new ImportResultItem
12771296 {
1278- Title = rotation . Title ,
1297+ Title = title ,
12791298 Status = "Imported" ,
12801299 MapRotationId = createResult . Result . Data . MapRotationId
12811300 } ) ;
@@ -1284,7 +1303,7 @@ public async Task<IActionResult> ImportConfirm(ImportMapRotationsConfirmViewMode
12841303 {
12851304 results . Add ( new ImportResultItem
12861305 {
1287- Title = rotation . Title ,
1306+ Title = title ,
12881307 Status = "Failed" ,
12891308 Error = "API returned failure"
12901309 } ) ;
@@ -1305,7 +1324,7 @@ public async Task<IActionResult> ImportConfirm(ImportMapRotationsConfirmViewMode
13051324 {
13061325 GameType = draft . GameType ,
13071326 ImportedCount = results . Count ( r => r . Status == "Imported" ) ,
1308- SkippedCount = selectedRotations . Count - results . Count ,
1327+ SkippedCount = selectedRotationsWithIndex . Count - results . Count ,
13091328 FailedCount = results . Count ( r => r . Status == "Failed" ) ,
13101329 MapsCreatedCount = mapsCreated ,
13111330 Results = results
0 commit comments