Skip to content
Browse files

Merge pull request #277 from taberrr/master

Paul Fowler's fix for duplicate apps
  • Loading branch information...
2 parents f1bcee4 + 0a9a804 commit 16ddf3d4c97c94ecf9d05219d7bc5b18791d8092 @omz committed Oct 29, 2015
Showing with 11 additions and 0 deletions.
  1. +11 −0 Classes/Report.m
View
11 Classes/Report.m
@@ -154,6 +154,17 @@ + (Report *)insertNewReportWithCSV:(NSString *)csv inAccount:(ASAccount *)accoun
NSString *productSKU = [rowDictionary objectForKey:kReportColumnSKU];
if (!productSKU) productSKU = [rowDictionary objectForKey:kReportColumnSKU2];
+ if ([productSKU hasSuffix:@" "])
+ { // bug in 26th October reports, sku has trailing space
+ // first delete 'productSKU plus space' duplicate and clean up the mess
+ Product *product = [productsBySKU objectForKey:productSKU];
+ if (product)
+ [moc deleteObject:product];
+ // now fix the SKU so it does not happen again
+ int len = (int)productSKU.length;
+ productSKU = [productSKU substringToIndex:len-1];
+ }
+
NSString *productVersion = [rowDictionary objectForKey:kReportColumnVersion];
Product *product = [productsBySKU objectForKey:productSKU];
if (!product) {

0 comments on commit 16ddf3d

Please sign in to comment.
Something went wrong with that request. Please try again.