{"action":"created","comment":{"url":"https://api.github.com/repos/CruGlobal/godtools-swift/pulls/comments/117113520","pull_request_review_id":38792177,"id":117113520,"diff_hunk":"@@ -87,6 +97,40 @@ class DownloadedResourceManager: GTDataManager {\n         saveToDisk()\n     }\n     \n+    private func translationShouldBeSaved(languageId: String, resourceId: String, version: Int16) -> Bool {\n+        let context = NSManagedObjectContext.mr_default()\n+        \n+        let predicate = NSPredicate(format: \"language.remoteId = %@ AND downloadedResource.remoteId = %@\",\n+                                    languageId,\n+                                    resourceId)\n+        \n+        guard let existingTranslations: [Translation] = Translation.mr_findAll(with: predicate, in: context) as? [Translation] else {\n+            // default to saving if in doubt.\n+            return true\n+        }\n+        \n+        let latestTranslation = existingTranslations.max(by: {$0.version < $1.version})\n+        \n+        return latestTranslation == nil || version > latestTranslation!.version\n+    }\n+    \n+    private func purgeTranslationsOlderThan(_ translation: Translation) {\n+        let context = NSManagedObjectContext.mr_default()","path":"godtools/Managers/DownloadResources/DownloadedResourceManager.swift","position":57,"original_position":57,"commit_id":"a9db6f766428accf7aa911c344c784c17e9556a6","original_commit_id":"a9db6f766428accf7aa911c344c784c17e9556a6","user":{"login":"ryancarlson","id":3768029,"avatar_url":"https://avatars1.githubusercontent.com/u/3768029?v=3","gravatar_id":"","url":"https://api.github.com/users/ryancarlson","html_url":"https://github.com/ryancarlson","followers_url":"https://api.github.com/users/ryancarlson/followers","following_url":"https://api.github.com/users/ryancarlson/following{/other_user}","gists_url":"https://api.github.com/users/ryancarlson/gists{/gist_id}","starred_url":"https://api.github.com/users/ryancarlson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ryancarlson/subscriptions","organizations_url":"https://api.github.com/users/ryancarlson/orgs","repos_url":"https://api.github.com/users/ryancarlson/repos","events_url":"https://api.github.com/users/ryancarlson/events{/privacy}","received_events_url":"https://api.github.com/users/ryancarlson/received_events","type":"User","site_admin":false},"body":"Can you show me a sample of what you're thinking?","created_at":"2017-05-17T21:23:12Z","updated_at":"2017-05-17T21:23:12Z","html_url":"https://github.com/CruGlobal/godtools-swift/pull/19#discussion_r117113520","pull_request_url":"https://api.github.com/repos/CruGlobal/godtools-swift/pulls/19","_links":{"self":{"href":"https://api.github.com/repos/CruGlobal/godtools-swift/pulls/comments/117113520"},"html":{"href":"https://github.com/CruGlobal/godtools-swift/pull/19#discussion_r117113520"},"pull_request":{"href":"https://api.github.com/repos/CruGlobal/godtools-swift/pulls/19"}}},"pull_request":{"url":"https://api.github.com/repos/CruGlobal/godtools-swift/pulls/19","id":121135677,"html_url":"https://github.com/CruGlobal/godtools-swift/pull/19","diff_url":"https://github.com/CruGlobal/godtools-swift/pull/19.diff","patch_url":"https://github.com/CruGlobal/godtools-swift/pull/19.patch","issue_url":"https://api.github.com/repos/CruGlobal/godtools-swift/issues/19","number":19,"state":"open","locked":false,"title":"Handle downloading of XML zip files from Server","user":{"login":"ryancarlson","id":3768029,"avatar_url":"https://avatars1.githubusercontent.com/u/3768029?v=3","gravatar_id":"","url":"https://api.github.com/users/ryancarlson","html_url":"https://github.com/ryancarlson","followers_url":"https://api.github.com/users/ryancarlson/followers","following_url":"https://api.github.com/users/ryancarlson/following{/other_user}","gists_url":"https://api.github.com/users/ryancarlson/gists{/gist_id}","starred_url":"https://api.github.com/users/ryancarlson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ryancarlson/subscriptions","organizations_url":"https://api.github.com/users/ryancarlson/orgs","repos_url":"https://api.github.com/users/ryancarlson/repos","events_url":"https://api.github.com/users/ryancarlson/events{/privacy}","received_events_url":"https://api.github.com/users/ryancarlson/received_events","type":"User","site_admin":false},"body":"Zip files are downloaded and extracted to a common resources folder.\r\n\r\nPriority is given to primary and parallel language at the time a resource is downloaded, but is not changed if the user changes languages.\r\n\r\nDeleting just flags that translations are not deleted and resources and languages should not be deleted, but does not currently purge resources from disk.","created_at":"2017-05-17T19:36:58Z","updated_at":"2017-05-17T21:23:12Z","closed_at":null,"merged_at":null,"merge_commit_sha":"15a63ea889b019db301d9c0214176a4867c5c638","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/CruGlobal/godtools-swift/pulls/19/commits","review_comments_url":"https://api.github.com/repos/CruGlobal/godtools-swift/pulls/19/comments","review_comment_url":"https://api.github.com/repos/CruGlobal/godtools-swift/pulls/comments{/number}","comments_url":"https://api.github.com/repos/CruGlobal/godtools-swift/issues/19/comments","statuses_url":"https://api.github.com/repos/CruGlobal/godtools-swift/statuses/a9db6f766428accf7aa911c344c784c17e9556a6","head":{"label":"CruGlobal:download-resources","ref":"download-resources","sha":"a9db6f766428accf7aa911c344c784c17e9556a6","user":{"login":"CruGlobal","id":1785912,"avatar_url":"https://avatars3.githubusercontent.com/u/1785912?v=3","gravatar_id":"","url":"https://api.github.com/users/CruGlobal","html_url":"https://github.com/CruGlobal","followers_url":"https://api.github.com/users/CruGlobal/followers","following_url":"https://api.github.com/users/CruGlobal/following{/other_user}","gists_url":"https://api.github.com/users/CruGlobal/gists{/gist_id}","starred_url":"https://api.github.com/users/CruGlobal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CruGlobal/subscriptions","organizations_url":"https://api.github.com/users/CruGlobal/orgs","repos_url":"https://api.github.com/users/CruGlobal/repos","events_url":"https://api.github.com/users/CruGlobal/events{/privacy}","received_events_url":"https://api.github.com/users/CruGlobal/received_events","type":"Organization","site_admin":false},"repo":{"id":72448605,"name":"godtools-swift","full_name":"CruGlobal/godtools-swift","owner":{"login":"CruGlobal","id":1785912,"avatar_url":"https://avatars3.githubusercontent.com/u/1785912?v=3","gravatar_id":"","url":"https://api.github.com/users/CruGlobal","html_url":"https://github.com/CruGlobal","followers_url":"https://api.github.com/users/CruGlobal/followers","following_url":"https://api.github.com/users/CruGlobal/following{/other_user}","gists_url":"https://api.github.com/users/CruGlobal/gists{/gist_id}","starred_url":"https://api.github.com/users/CruGlobal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CruGlobal/subscriptions","organizations_url":"https://api.github.com/users/CruGlobal/orgs","repos_url":"https://api.github.com/users/CruGlobal/repos","events_url":"https://api.github.com/users/CruGlobal/events{/privacy}","received_events_url":"https://api.github.com/users/CruGlobal/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/CruGlobal/godtools-swift","description":"Swift 3.0 version of God Tools","fork":false,"url":"https://api.github.com/repos/CruGlobal/godtools-swift","forks_url":"https://api.github.com/repos/CruGlobal/godtools-swift/forks","keys_url":"https://api.github.com/repos/CruGlobal/godtools-swift/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CruGlobal/godtools-swift/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CruGlobal/godtools-swift/teams","hooks_url":"https://api.github.com/repos/CruGlobal/godtools-swift/hooks","issue_events_url":"https://api.github.com/repos/CruGlobal/godtools-swift/issues/events{/number}","events_url":"https://api.github.com/repos/CruGlobal/godtools-swift/events","assignees_url":"https://api.github.com/repos/CruGlobal/godtools-swift/assignees{/user}","branches_url":"https://api.github.com/repos/CruGlobal/godtools-swift/branches{/branch}","tags_url":"https://api.github.com/repos/CruGlobal/godtools-swift/tags","blobs_url":"https://api.github.com/repos/CruGlobal/godtools-swift/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CruGlobal/godtools-swift/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CruGlobal/godtools-swift/git/refs{/sha}","trees_url":"https://api.github.com/repos/CruGlobal/godtools-swift/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CruGlobal/godtools-swift/statuses/{sha}","languages_url":"https://api.github.com/repos/CruGlobal/godtools-swift/languages","stargazers_url":"https://api.github.com/repos/CruGlobal/godtools-swift/stargazers","contributors_url":"https://api.github.com/repos/CruGlobal/godtools-swift/contributors","subscribers_url":"https://api.github.com/repos/CruGlobal/godtools-swift/subscribers","subscription_url":"https://api.github.com/repos/CruGlobal/godtools-swift/subscription","commits_url":"https://api.github.com/repos/CruGlobal/godtools-swift/commits{/sha}","git_commits_url":"https://api.github.com/repos/CruGlobal/godtools-swift/git/commits{/sha}","comments_url":"https://api.github.com/repos/CruGlobal/godtools-swift/comments{/number}","issue_comment_url":"https://api.github.com/repos/CruGlobal/godtools-swift/issues/comments{/number}","contents_url":"https://api.github.com/repos/CruGlobal/godtools-swift/contents/{+path}","compare_url":"https://api.github.com/repos/CruGlobal/godtools-swift/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CruGlobal/godtools-swift/merges","archive_url":"https://api.github.com/repos/CruGlobal/godtools-swift/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CruGlobal/godtools-swift/downloads","issues_url":"https://api.github.com/repos/CruGlobal/godtools-swift/issues{/number}","pulls_url":"https://api.github.com/repos/CruGlobal/godtools-swift/pulls{/number}","milestones_url":"https://api.github.com/repos/CruGlobal/godtools-swift/milestones{/number}","notifications_url":"https://api.github.com/repos/CruGlobal/godtools-swift/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CruGlobal/godtools-swift/labels{/name}","releases_url":"https://api.github.com/repos/CruGlobal/godtools-swift/releases{/id}","deployments_url":"https://api.github.com/repos/CruGlobal/godtools-swift/deployments","created_at":"2016-10-31T15:12:36Z","updated_at":"2017-04-18T23:32:47Z","pushed_at":"2017-05-17T21:20:42Z","git_url":"git://github.com/CruGlobal/godtools-swift.git","ssh_url":"git@github.com:CruGlobal/godtools-swift.git","clone_url":"https://github.com/CruGlobal/godtools-swift.git","svn_url":"https://github.com/CruGlobal/godtools-swift","homepage":null,"size":10507,"stargazers_count":1,"watchers_count":1,"language":"Swift","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":4,"forks":0,"open_issues":4,"watchers":1,"default_branch":"develop"}},"base":{"label":"CruGlobal:develop","ref":"develop","sha":"0b9a3db4c964290e6e8b850f0010c632e9ea4b89","user":{"login":"CruGlobal","id":1785912,"avatar_url":"https://avatars3.githubusercontent.com/u/1785912?v=3","gravatar_id":"","url":"https://api.github.com/users/CruGlobal","html_url":"https://github.com/CruGlobal","followers_url":"https://api.github.com/users/CruGlobal/followers","following_url":"https://api.github.com/users/CruGlobal/following{/other_user}","gists_url":"https://api.github.com/users/CruGlobal/gists{/gist_id}","starred_url":"https://api.github.com/users/CruGlobal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CruGlobal/subscriptions","organizations_url":"https://api.github.com/users/CruGlobal/orgs","repos_url":"https://api.github.com/users/CruGlobal/repos","events_url":"https://api.github.com/users/CruGlobal/events{/privacy}","received_events_url":"https://api.github.com/users/CruGlobal/received_events","type":"Organization","site_admin":false},"repo":{"id":72448605,"name":"godtools-swift","full_name":"CruGlobal/godtools-swift","owner":{"login":"CruGlobal","id":1785912,"avatar_url":"https://avatars3.githubusercontent.com/u/1785912?v=3","gravatar_id":"","url":"https://api.github.com/users/CruGlobal","html_url":"https://github.com/CruGlobal","followers_url":"https://api.github.com/users/CruGlobal/followers","following_url":"https://api.github.com/users/CruGlobal/following{/other_user}","gists_url":"https://api.github.com/users/CruGlobal/gists{/gist_id}","starred_url":"https://api.github.com/users/CruGlobal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CruGlobal/subscriptions","organizations_url":"https://api.github.com/users/CruGlobal/orgs","repos_url":"https://api.github.com/users/CruGlobal/repos","events_url":"https://api.github.com/users/CruGlobal/events{/privacy}","received_events_url":"https://api.github.com/users/CruGlobal/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/CruGlobal/godtools-swift","description":"Swift 3.0 version of God Tools","fork":false,"url":"https://api.github.com/repos/CruGlobal/godtools-swift","forks_url":"https://api.github.com/repos/CruGlobal/godtools-swift/forks","keys_url":"https://api.github.com/repos/CruGlobal/godtools-swift/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CruGlobal/godtools-swift/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CruGlobal/godtools-swift/teams","hooks_url":"https://api.github.com/repos/CruGlobal/godtools-swift/hooks","issue_events_url":"https://api.github.com/repos/CruGlobal/godtools-swift/issues/events{/number}","events_url":"https://api.github.com/repos/CruGlobal/godtools-swift/events","assignees_url":"https://api.github.com/repos/CruGlobal/godtools-swift/assignees{/user}","branches_url":"https://api.github.com/repos/CruGlobal/godtools-swift/branches{/branch}","tags_url":"https://api.github.com/repos/CruGlobal/godtools-swift/tags","blobs_url":"https://api.github.com/repos/CruGlobal/godtools-swift/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CruGlobal/godtools-swift/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CruGlobal/godtools-swift/git/refs{/sha}","trees_url":"https://api.github.com/repos/CruGlobal/godtools-swift/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CruGlobal/godtools-swift/statuses/{sha}","languages_url":"https://api.github.com/repos/CruGlobal/godtools-swift/languages","stargazers_url":"https://api.github.com/repos/CruGlobal/godtools-swift/stargazers","contributors_url":"https://api.github.com/repos/CruGlobal/godtools-swift/contributors","subscribers_url":"https://api.github.com/repos/CruGlobal/godtools-swift/subscribers","subscription_url":"https://api.github.com/repos/CruGlobal/godtools-swift/subscription","commits_url":"https://api.github.com/repos/CruGlobal/godtools-swift/commits{/sha}","git_commits_url":"https://api.github.com/repos/CruGlobal/godtools-swift/git/commits{/sha}","comments_url":"https://api.github.com/repos/CruGlobal/godtools-swift/comments{/number}","issue_comment_url":"https://api.github.com/repos/CruGlobal/godtools-swift/issues/comments{/number}","contents_url":"https://api.github.com/repos/CruGlobal/godtools-swift/contents/{+path}","compare_url":"https://api.github.com/repos/CruGlobal/godtools-swift/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CruGlobal/godtools-swift/merges","archive_url":"https://api.github.com/repos/CruGlobal/godtools-swift/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CruGlobal/godtools-swift/downloads","issues_url":"https://api.github.com/repos/CruGlobal/godtools-swift/issues{/number}","pulls_url":"https://api.github.com/repos/CruGlobal/godtools-swift/pulls{/number}","milestones_url":"https://api.github.com/repos/CruGlobal/godtools-swift/milestones{/number}","notifications_url":"https://api.github.com/repos/CruGlobal/godtools-swift/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CruGlobal/godtools-swift/labels{/name}","releases_url":"https://api.github.com/repos/CruGlobal/godtools-swift/releases{/id}","deployments_url":"https://api.github.com/repos/CruGlobal/godtools-swift/deployments","created_at":"2016-10-31T15:12:36Z","updated_at":"2017-04-18T23:32:47Z","pushed_at":"2017-05-17T21:20:42Z","git_url":"git://github.com/CruGlobal/godtools-swift.git","ssh_url":"git@github.com:CruGlobal/godtools-swift.git","clone_url":"https://github.com/CruGlobal/godtools-swift.git","svn_url":"https://github.com/CruGlobal/godtools-swift","homepage":null,"size":10507,"stargazers_count":1,"watchers_count":1,"language":"Swift","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":4,"forks":0,"open_issues":4,"watchers":1,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/CruGlobal/godtools-swift/pulls/19"},"html":{"href":"https://github.com/CruGlobal/godtools-swift/pull/19"},"issue":{"href":"https://api.github.com/repos/CruGlobal/godtools-swift/issues/19"},"comments":{"href":"https://api.github.com/repos/CruGlobal/godtools-swift/issues/19/comments"},"review_comments":{"href":"https://api.github.com/repos/CruGlobal/godtools-swift/pulls/19/comments"},"review_comment":{"href":"https://api.github.com/repos/CruGlobal/godtools-swift/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/CruGlobal/godtools-swift/pulls/19/commits"},"statuses":{"href":"https://api.github.com/repos/CruGlobal/godtools-swift/statuses/a9db6f766428accf7aa911c344c784c17e9556a6"}}}}
{"actor":{"display_login":"ryancarlson"}}