{"action":"created","comment":{"url":"https://api.github.com/repos/xorserer/Playground/pulls/comments/51590000","id":51590000,"diff_hunk":"@@ -0,0 +1,49 @@\n+// Copyright (c) 2016 Lightricks. All rights reserved.\n+// Created by Lior Bar.\n+\n+#import \"FlickerOrganizer.h\"\n+\n+#import \"FlickrFetcher.h\"\n+#import \"FlickerPlaceData.h\"\n+#import \"TableSectionWithRows.h\"\n+\n+NS_ASSUME_NONNULL_BEGIN\n+\n+@implementation FlickerOrganizer\n+\n++ (NSArray<TableSectionWithRows *> *)dataToSortedCountrySections:(NSDictionary *)data {\n+  NSArray *dataArray = [data valueForKeyPath:FLICKR_RESULTS_PLACES];\n+  NSArray *placesArray = [self dataArrayToPlaceDataArray:dataArray];\n+  NSArray *placesArraySortedByCountryAlphabetically = [FlickerOrganizer sortCountryAlphabetically:placesArray];\n+  return [FlickerOrganizer splitToCountrySections:placesArraySortedByCountryAlphabetically];\n+}\n+\n++ (NSArray<FlickerPlaceData *> *)dataArrayToPlaceDataArray:(NSArray *)dataArray {\n+  NSMutableArray<FlickerPlaceData *> *placeArray = [[NSMutableArray<FlickerPlaceData *> alloc]  init];\n+  for (NSDictionary *placeData in dataArray) {\n+    [placeArray addObject:[[FlickerPlaceData alloc] initWithFlickerPlaceData:placeData]];\n+  }\n+  return [placeArray copy];\n+}\n+\n++ (NSArray<FlickerPlaceData *> *)sortCountryAlphabetically:(NSArray<FlickerPlaceData *> *)array {\n+  return [array sortedArrayUsingSelector:@selector(compare:)];\n+}\n+\n++ (NSArray<TableSectionWithRows *> *)splitToCountrySections:(NSArray<FlickerPlaceData *> *)placesArraySortedByCountry {\n+  NSString *lastCountry = nil;\n+  NSMutableArray<TableSectionWithRows *> *sectionsData = [[NSMutableArray<TableSectionWithRows *> alloc] init];\n+  for (FlickerPlaceData *place in placesArraySortedByCountry) {\n+    NSString *title = place.country;\n+    if(!lastCountry || ![lastCountry isEqual:title]) {","path":"TopPlaces/TopPlaces/controller/FlickerOrganizer.m","position":38,"original_position":38,"commit_id":"ef1af270691d4fed36660994053f7f2bde7259dd","original_commit_id":"ef1af270691d4fed36660994053f7f2bde7259dd","user":{"login":"xorserer","id":5460245,"avatar_url":"https://avatars.githubusercontent.com/u/5460245?v=3","gravatar_id":"","url":"https://api.github.com/users/xorserer","html_url":"https://github.com/xorserer","followers_url":"https://api.github.com/users/xorserer/followers","following_url":"https://api.github.com/users/xorserer/following{/other_user}","gists_url":"https://api.github.com/users/xorserer/gists{/gist_id}","starred_url":"https://api.github.com/users/xorserer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xorserer/subscriptions","organizations_url":"https://api.github.com/users/xorserer/orgs","repos_url":"https://api.github.com/users/xorserer/repos","events_url":"https://api.github.com/users/xorserer/events{/privacy}","received_events_url":"https://api.github.com/users/xorserer/received_events","type":"User","site_admin":false},"body":"Space after `(`","created_at":"2016-02-02T16:11:46Z","updated_at":"2016-02-02T16:11:46Z","html_url":"https://github.com/xorserer/Playground/pull/14#discussion_r51590000","pull_request_url":"https://api.github.com/repos/xorserer/Playground/pulls/14","_links":{"self":{"href":"https://api.github.com/repos/xorserer/Playground/pulls/comments/51590000"},"html":{"href":"https://github.com/xorserer/Playground/pull/14#discussion_r51590000"},"pull_request":{"href":"https://api.github.com/repos/xorserer/Playground/pulls/14"}}},"pull_request":{"url":"https://api.github.com/repos/xorserer/Playground/pulls/14","id":54949482,"html_url":"https://github.com/xorserer/Playground/pull/14","diff_url":"https://github.com/xorserer/Playground/pull/14.diff","patch_url":"https://github.com/xorserer/Playground/pull/14.patch","issue_url":"https://api.github.com/repos/xorserer/Playground/issues/14","number":14,"state":"open","locked":false,"title":"Top places","user":{"login":"lior7","id":16175389,"avatar_url":"https://avatars.githubusercontent.com/u/16175389?v=3","gravatar_id":"","url":"https://api.github.com/users/lior7","html_url":"https://github.com/lior7","followers_url":"https://api.github.com/users/lior7/followers","following_url":"https://api.github.com/users/lior7/following{/other_user}","gists_url":"https://api.github.com/users/lior7/gists{/gist_id}","starred_url":"https://api.github.com/users/lior7/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lior7/subscriptions","organizations_url":"https://api.github.com/users/lior7/orgs","repos_url":"https://api.github.com/users/lior7/repos","events_url":"https://api.github.com/users/lior7/events{/privacy}","received_events_url":"https://api.github.com/users/lior7/received_events","type":"User","site_admin":false},"body":"Ios ex5, no inheritance.","created_at":"2016-01-04T07:33:49Z","updated_at":"2016-02-02T16:11:46Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6ad5ad8d485ee066c11e4fb7d7c4eec7935c23dc","assignee":{"login":"xorserer","id":5460245,"avatar_url":"https://avatars.githubusercontent.com/u/5460245?v=3","gravatar_id":"","url":"https://api.github.com/users/xorserer","html_url":"https://github.com/xorserer","followers_url":"https://api.github.com/users/xorserer/followers","following_url":"https://api.github.com/users/xorserer/following{/other_user}","gists_url":"https://api.github.com/users/xorserer/gists{/gist_id}","starred_url":"https://api.github.com/users/xorserer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xorserer/subscriptions","organizations_url":"https://api.github.com/users/xorserer/orgs","repos_url":"https://api.github.com/users/xorserer/repos","events_url":"https://api.github.com/users/xorserer/events{/privacy}","received_events_url":"https://api.github.com/users/xorserer/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/xorserer/Playground/pulls/14/commits","review_comments_url":"https://api.github.com/repos/xorserer/Playground/pulls/14/comments","review_comment_url":"https://api.github.com/repos/xorserer/Playground/pulls/comments{/number}","comments_url":"https://api.github.com/repos/xorserer/Playground/issues/14/comments","statuses_url":"https://api.github.com/repos/xorserer/Playground/statuses/ef1af270691d4fed36660994053f7f2bde7259dd","head":{"label":"lior7:TopPlaces","ref":"TopPlaces","sha":"ef1af270691d4fed36660994053f7f2bde7259dd","user":{"login":"lior7","id":16175389,"avatar_url":"https://avatars.githubusercontent.com/u/16175389?v=3","gravatar_id":"","url":"https://api.github.com/users/lior7","html_url":"https://github.com/lior7","followers_url":"https://api.github.com/users/lior7/followers","following_url":"https://api.github.com/users/lior7/following{/other_user}","gists_url":"https://api.github.com/users/lior7/gists{/gist_id}","starred_url":"https://api.github.com/users/lior7/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lior7/subscriptions","organizations_url":"https://api.github.com/users/lior7/orgs","repos_url":"https://api.github.com/users/lior7/repos","events_url":"https://api.github.com/users/lior7/events{/privacy}","received_events_url":"https://api.github.com/users/lior7/received_events","type":"User","site_admin":false},"repo":{"id":47973308,"name":"Playground","full_name":"lior7/Playground","owner":{"login":"lior7","id":16175389,"avatar_url":"https://avatars.githubusercontent.com/u/16175389?v=3","gravatar_id":"","url":"https://api.github.com/users/lior7","html_url":"https://github.com/lior7","followers_url":"https://api.github.com/users/lior7/followers","following_url":"https://api.github.com/users/lior7/following{/other_user}","gists_url":"https://api.github.com/users/lior7/gists{/gist_id}","starred_url":"https://api.github.com/users/lior7/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lior7/subscriptions","organizations_url":"https://api.github.com/users/lior7/orgs","repos_url":"https://api.github.com/users/lior7/repos","events_url":"https://api.github.com/users/lior7/events{/privacy}","received_events_url":"https://api.github.com/users/lior7/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/lior7/Playground","description":"Repository for learning about GitHub & testing new stuff","fork":true,"url":"https://api.github.com/repos/lior7/Playground","forks_url":"https://api.github.com/repos/lior7/Playground/forks","keys_url":"https://api.github.com/repos/lior7/Playground/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lior7/Playground/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lior7/Playground/teams","hooks_url":"https://api.github.com/repos/lior7/Playground/hooks","issue_events_url":"https://api.github.com/repos/lior7/Playground/issues/events{/number}","events_url":"https://api.github.com/repos/lior7/Playground/events","assignees_url":"https://api.github.com/repos/lior7/Playground/assignees{/user}","branches_url":"https://api.github.com/repos/lior7/Playground/branches{/branch}","tags_url":"https://api.github.com/repos/lior7/Playground/tags","blobs_url":"https://api.github.com/repos/lior7/Playground/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lior7/Playground/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lior7/Playground/git/refs{/sha}","trees_url":"https://api.github.com/repos/lior7/Playground/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lior7/Playground/statuses/{sha}","languages_url":"https://api.github.com/repos/lior7/Playground/languages","stargazers_url":"https://api.github.com/repos/lior7/Playground/stargazers","contributors_url":"https://api.github.com/repos/lior7/Playground/contributors","subscribers_url":"https://api.github.com/repos/lior7/Playground/subscribers","subscription_url":"https://api.github.com/repos/lior7/Playground/subscription","commits_url":"https://api.github.com/repos/lior7/Playground/commits{/sha}","git_commits_url":"https://api.github.com/repos/lior7/Playground/git/commits{/sha}","comments_url":"https://api.github.com/repos/lior7/Playground/comments{/number}","issue_comment_url":"https://api.github.com/repos/lior7/Playground/issues/comments{/number}","contents_url":"https://api.github.com/repos/lior7/Playground/contents/{+path}","compare_url":"https://api.github.com/repos/lior7/Playground/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lior7/Playground/merges","archive_url":"https://api.github.com/repos/lior7/Playground/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lior7/Playground/downloads","issues_url":"https://api.github.com/repos/lior7/Playground/issues{/number}","pulls_url":"https://api.github.com/repos/lior7/Playground/pulls{/number}","milestones_url":"https://api.github.com/repos/lior7/Playground/milestones{/number}","notifications_url":"https://api.github.com/repos/lior7/Playground/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lior7/Playground/labels{/name}","releases_url":"https://api.github.com/repos/lior7/Playground/releases{/id}","deployments_url":"https://api.github.com/repos/lior7/Playground/deployments","created_at":"2015-12-14T12:17:21Z","updated_at":"2015-12-21T07:33:41Z","pushed_at":"2016-01-25T12:40:03Z","git_url":"git://github.com/lior7/Playground.git","ssh_url":"git@github.com:lior7/Playground.git","clone_url":"https://github.com/lior7/Playground.git","svn_url":"https://github.com/lior7/Playground","homepage":null,"size":612,"stargazers_count":0,"watchers_count":0,"language":"Objective-C","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"develop"}},"base":{"label":"xorserer:develop","ref":"develop","sha":"53f157782cccfcfcbaa5c99fc8c215237e9bb9c3","user":{"login":"xorserer","id":5460245,"avatar_url":"https://avatars.githubusercontent.com/u/5460245?v=3","gravatar_id":"","url":"https://api.github.com/users/xorserer","html_url":"https://github.com/xorserer","followers_url":"https://api.github.com/users/xorserer/followers","following_url":"https://api.github.com/users/xorserer/following{/other_user}","gists_url":"https://api.github.com/users/xorserer/gists{/gist_id}","starred_url":"https://api.github.com/users/xorserer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xorserer/subscriptions","organizations_url":"https://api.github.com/users/xorserer/orgs","repos_url":"https://api.github.com/users/xorserer/repos","events_url":"https://api.github.com/users/xorserer/events{/privacy}","received_events_url":"https://api.github.com/users/xorserer/received_events","type":"User","site_admin":false},"repo":{"id":33937810,"name":"Playground","full_name":"xorserer/Playground","owner":{"login":"xorserer","id":5460245,"avatar_url":"https://avatars.githubusercontent.com/u/5460245?v=3","gravatar_id":"","url":"https://api.github.com/users/xorserer","html_url":"https://github.com/xorserer","followers_url":"https://api.github.com/users/xorserer/followers","following_url":"https://api.github.com/users/xorserer/following{/other_user}","gists_url":"https://api.github.com/users/xorserer/gists{/gist_id}","starred_url":"https://api.github.com/users/xorserer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xorserer/subscriptions","organizations_url":"https://api.github.com/users/xorserer/orgs","repos_url":"https://api.github.com/users/xorserer/repos","events_url":"https://api.github.com/users/xorserer/events{/privacy}","received_events_url":"https://api.github.com/users/xorserer/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/xorserer/Playground","description":"Repository for learning about GitHub & testing new stuff","fork":false,"url":"https://api.github.com/repos/xorserer/Playground","forks_url":"https://api.github.com/repos/xorserer/Playground/forks","keys_url":"https://api.github.com/repos/xorserer/Playground/keys{/key_id}","collaborators_url":"https://api.github.com/repos/xorserer/Playground/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/xorserer/Playground/teams","hooks_url":"https://api.github.com/repos/xorserer/Playground/hooks","issue_events_url":"https://api.github.com/repos/xorserer/Playground/issues/events{/number}","events_url":"https://api.github.com/repos/xorserer/Playground/events","assignees_url":"https://api.github.com/repos/xorserer/Playground/assignees{/user}","branches_url":"https://api.github.com/repos/xorserer/Playground/branches{/branch}","tags_url":"https://api.github.com/repos/xorserer/Playground/tags","blobs_url":"https://api.github.com/repos/xorserer/Playground/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/xorserer/Playground/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/xorserer/Playground/git/refs{/sha}","trees_url":"https://api.github.com/repos/xorserer/Playground/git/trees{/sha}","statuses_url":"https://api.github.com/repos/xorserer/Playground/statuses/{sha}","languages_url":"https://api.github.com/repos/xorserer/Playground/languages","stargazers_url":"https://api.github.com/repos/xorserer/Playground/stargazers","contributors_url":"https://api.github.com/repos/xorserer/Playground/contributors","subscribers_url":"https://api.github.com/repos/xorserer/Playground/subscribers","subscription_url":"https://api.github.com/repos/xorserer/Playground/subscription","commits_url":"https://api.github.com/repos/xorserer/Playground/commits{/sha}","git_commits_url":"https://api.github.com/repos/xorserer/Playground/git/commits{/sha}","comments_url":"https://api.github.com/repos/xorserer/Playground/comments{/number}","issue_comment_url":"https://api.github.com/repos/xorserer/Playground/issues/comments{/number}","contents_url":"https://api.github.com/repos/xorserer/Playground/contents/{+path}","compare_url":"https://api.github.com/repos/xorserer/Playground/compare/{base}...{head}","merges_url":"https://api.github.com/repos/xorserer/Playground/merges","archive_url":"https://api.github.com/repos/xorserer/Playground/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/xorserer/Playground/downloads","issues_url":"https://api.github.com/repos/xorserer/Playground/issues{/number}","pulls_url":"https://api.github.com/repos/xorserer/Playground/pulls{/number}","milestones_url":"https://api.github.com/repos/xorserer/Playground/milestones{/number}","notifications_url":"https://api.github.com/repos/xorserer/Playground/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/xorserer/Playground/labels{/name}","releases_url":"https://api.github.com/repos/xorserer/Playground/releases{/id}","deployments_url":"https://api.github.com/repos/xorserer/Playground/deployments","created_at":"2015-04-14T14:47:53Z","updated_at":"2015-12-02T09:14:31Z","pushed_at":"2016-01-25T12:40:04Z","git_url":"git://github.com/xorserer/Playground.git","ssh_url":"git@github.com:xorserer/Playground.git","clone_url":"https://github.com/xorserer/Playground.git","svn_url":"https://github.com/xorserer/Playground","homepage":null,"size":253,"stargazers_count":0,"watchers_count":0,"language":"Objective-C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":1,"forks":2,"open_issues":1,"watchers":0,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/xorserer/Playground/pulls/14"},"html":{"href":"https://github.com/xorserer/Playground/pull/14"},"issue":{"href":"https://api.github.com/repos/xorserer/Playground/issues/14"},"comments":{"href":"https://api.github.com/repos/xorserer/Playground/issues/14/comments"},"review_comments":{"href":"https://api.github.com/repos/xorserer/Playground/pulls/14/comments"},"review_comment":{"href":"https://api.github.com/repos/xorserer/Playground/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/xorserer/Playground/pulls/14/commits"},"statuses":{"href":"https://api.github.com/repos/xorserer/Playground/statuses/ef1af270691d4fed36660994053f7f2bde7259dd"}}}}