{"action":"created","comment":{"url":"https://api.github.com/repos/StoDevX/AAO-React-Native/pulls/comments/165475208","pull_request_review_id":93422317,"id":165475208,"diff_hunk":"@@ -17,54 +17,54 @@ type TermInfoType = {\n \ttype: string,\n }\n \n-export async function updateStoredCourses(): boolean {\n+export async function updateStoredCourses(): Promise<boolean> {\n \tRNFS.readDir(COURSE_STORAGE_DIR + '/terms').catch(() => {\n \t\tRNFS.mkdir(COURSE_STORAGE_DIR + '/terms')\n \t})\n \tconst outdatedTerms: Array<TermType> = await determineOutdatedTerms()\n-\toutdatedTerms.forEach(term => {\n-\t\tstoreTermCoursesFromServer(term.path)\n-\t})\n+\tconst promises = outdatedTerms.map(term =>\n+\t\tstoreTermCoursesFromServer(term.path),\n+\t)\n+\tawait Promise.all(promises)\n \treturn outdatedTerms.length === 0 ? false : true\n }\n \n-async function loadCurrentTermsFromServer(): Array<TermType> {\n-\ttry {\n-\t\tconst today = new Date()\n-\t\tconst thisYear = today.getFullYear()\n-\t\tconst resp: TermInfoType = await fetchJson(INFO_PAGE)\n-\t\tconst terms: Array<TermType> = resp.files.filter(\n-\t\t\tfile => file.type === 'json' && file.year > thisYear - 5,\n-\t\t)\n-\t\treturn terms\n-\t} catch (error) {\n-\t\tconsole.log(error)\n-\t}\n+async function loadCurrentTermsFromServer(): Promise<Array<TermType>> {\n+\tconst today = new Date()\n+\tconst thisYear = today.getFullYear()\n+\tconst resp: TermInfoType = await fetchJson(INFO_PAGE).catch(() => ({\n+\t\tfiles: [],\n+\t\ttype: 'error',\n+\t}))\n+\tconst terms: Array<TermType> = resp.files.filter(\n+\t\tfile => file.type === 'json' && file.year > thisYear - 5,\n+\t)\n+\treturn terms\n }\n \n-export async function loadTermsFromStorage(): Array<TermType> {\n+export function loadTermsFromStorage(): Promise<Array<TermType>> {\n \treturn RNFS.readFile(TERMS_FILE)\n \t\t.then(contents => {\n-\t\t\tconst localTerms: Array<TermType> = JSON.parse(contents)\n-\t\t\treturn localTerms\n+\t\t\treturn JSON.parse(contents)\n \t\t})\n \t\t.catch(() => {\n \t\t\treturn []\n \t\t})\n }\n \n-async function determineOutdatedTerms(): Array<TermType> {\n+async function determineOutdatedTerms(): Promise<Array<TermType>> {\n \tconst remoteTerms: Array<TermType> = await loadCurrentTermsFromServer()\n \tconst localTerms: Array<TermType> = await loadTermsFromStorage()\n \tif (localTerms.length === 0) {\n \t\tstoreTermInfo(remoteTerms)\n \t\treturn remoteTerms\n \t}\n-\tlet outdatedTerms = localTerms.filter(\n-\t\tlocalTerm =>\n-\t\t\tlocalTerm.hash !=\n-\t\t\tremoteTerms.find(remoteTerm => remoteTerm.term === localTerm.term).hash,\n-\t)\n+\tlet outdatedTerms = localTerms.filter(localTerm => {\n+\t\tconst match = remoteTerms.find(\n+\t\t\tremoteTerm => remoteTerm.term === localTerm.term,\n+\t\t)\n+\t\treturn match === undefined ? true : localTerm.hash != match.hash","path":"source/lib/course-search/update-course-storage.js","position":66,"original_position":75,"commit_id":"8e4cce5d17797e80a5fa6f394081a961b5e0bb9d","original_commit_id":"8e4cce5d17797e80a5fa6f394081a961b5e0bb9d","user":{"login":"hawkrives","id":464441,"avatar_url":"https://avatars0.githubusercontent.com/u/464441?v=4","gravatar_id":"","url":"https://api.github.com/users/hawkrives","html_url":"https://github.com/hawkrives","followers_url":"https://api.github.com/users/hawkrives/followers","following_url":"https://api.github.com/users/hawkrives/following{/other_user}","gists_url":"https://api.github.com/users/hawkrives/gists{/gist_id}","starred_url":"https://api.github.com/users/hawkrives/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hawkrives/subscriptions","organizations_url":"https://api.github.com/users/hawkrives/orgs","repos_url":"https://api.github.com/users/hawkrives/repos","events_url":"https://api.github.com/users/hawkrives/events{/privacy}","received_events_url":"https://api.github.com/users/hawkrives/received_events","type":"User","site_admin":false},"body":"Maybe `return match ? match.hash === localTerm.hash : true`, to tighten it up","created_at":"2018-02-01T20:14:58Z","updated_at":"2018-02-01T20:24:24Z","html_url":"https://github.com/StoDevX/AAO-React-Native/pull/2293#discussion_r165475208","pull_request_url":"https://api.github.com/repos/StoDevX/AAO-React-Native/pulls/2293","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/StoDevX/AAO-React-Native/pulls/comments/165475208"},"html":{"href":"https://github.com/StoDevX/AAO-React-Native/pull/2293#discussion_r165475208"},"pull_request":{"href":"https://api.github.com/repos/StoDevX/AAO-React-Native/pulls/2293"}}},"pull_request":{"url":"https://api.github.com/repos/StoDevX/AAO-React-Native/pulls/2293","id":166445617,"html_url":"https://github.com/StoDevX/AAO-React-Native/pull/2293","diff_url":"https://github.com/StoDevX/AAO-React-Native/pull/2293.diff","patch_url":"https://github.com/StoDevX/AAO-React-Native/pull/2293.patch","issue_url":"https://api.github.com/repos/StoDevX/AAO-React-Native/issues/2293","number":2293,"state":"open","locked":false,"title":"[WIP] Add course search","user":{"login":"hannesmcman","id":24640726,"avatar_url":"https://avatars3.githubusercontent.com/u/24640726?v=4","gravatar_id":"","url":"https://api.github.com/users/hannesmcman","html_url":"https://github.com/hannesmcman","followers_url":"https://api.github.com/users/hannesmcman/followers","following_url":"https://api.github.com/users/hannesmcman/following{/other_user}","gists_url":"https://api.github.com/users/hannesmcman/gists{/gist_id}","starred_url":"https://api.github.com/users/hannesmcman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hannesmcman/subscriptions","organizations_url":"https://api.github.com/users/hannesmcman/orgs","repos_url":"https://api.github.com/users/hannesmcman/repos","events_url":"https://api.github.com/users/hannesmcman/events{/privacy}","received_events_url":"https://api.github.com/users/hannesmcman/received_events","type":"User","site_admin":false},"body":"Add ability to search and browse through the class & lab in the SIS component, resolves #2178 ","created_at":"2018-02-01T05:14:54Z","updated_at":"2018-02-01T20:24:24Z","closed_at":null,"merged_at":null,"merge_commit_sha":"223c5c8c179dae56e25ffc0fa180d13d193605ee","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"milestone":null,"commits_url":"https://api.github.com/repos/StoDevX/AAO-React-Native/pulls/2293/commits","review_comments_url":"https://api.github.com/repos/StoDevX/AAO-React-Native/pulls/2293/comments","review_comment_url":"https://api.github.com/repos/StoDevX/AAO-React-Native/pulls/comments{/number}","comments_url":"https://api.github.com/repos/StoDevX/AAO-React-Native/issues/2293/comments","statuses_url":"https://api.github.com/repos/StoDevX/AAO-React-Native/statuses/8e4cce5d17797e80a5fa6f394081a961b5e0bb9d","head":{"label":"StoDevX:add-course-search","ref":"add-course-search","sha":"8e4cce5d17797e80a5fa6f394081a961b5e0bb9d","user":{"login":"StoDevX","id":16405322,"avatar_url":"https://avatars0.githubusercontent.com/u/16405322?v=4","gravatar_id":"","url":"https://api.github.com/users/StoDevX","html_url":"https://github.com/StoDevX","followers_url":"https://api.github.com/users/StoDevX/followers","following_url":"https://api.github.com/users/StoDevX/following{/other_user}","gists_url":"https://api.github.com/users/StoDevX/gists{/gist_id}","starred_url":"https://api.github.com/users/StoDevX/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/StoDevX/subscriptions","organizations_url":"https://api.github.com/users/StoDevX/orgs","repos_url":"https://api.github.com/users/StoDevX/repos","events_url":"https://api.github.com/users/StoDevX/events{/privacy}","received_events_url":"https://api.github.com/users/StoDevX/received_events","type":"Organization","site_admin":false},"repo":{"id":48415146,"name":"AAO-React-Native","full_name":"StoDevX/AAO-React-Native","owner":{"login":"StoDevX","id":16405322,"avatar_url":"https://avatars0.githubusercontent.com/u/16405322?v=4","gravatar_id":"","url":"https://api.github.com/users/StoDevX","html_url":"https://github.com/StoDevX","followers_url":"https://api.github.com/users/StoDevX/followers","following_url":"https://api.github.com/users/StoDevX/following{/other_user}","gists_url":"https://api.github.com/users/StoDevX/gists{/gist_id}","starred_url":"https://api.github.com/users/StoDevX/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/StoDevX/subscriptions","organizations_url":"https://api.github.com/users/StoDevX/orgs","repos_url":"https://api.github.com/users/StoDevX/repos","events_url":"https://api.github.com/users/StoDevX/events{/privacy}","received_events_url":"https://api.github.com/users/StoDevX/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/StoDevX/AAO-React-Native","description":"The St. Olaf community, now in pocket size.","fork":false,"url":"https://api.github.com/repos/StoDevX/AAO-React-Native","forks_url":"https://api.github.com/repos/StoDevX/AAO-React-Native/forks","keys_url":"https://api.github.com/repos/StoDevX/AAO-React-Native/keys{/key_id}","collaborators_url":"https://api.github.com/repos/StoDevX/AAO-React-Native/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/StoDevX/AAO-React-Native/teams","hooks_url":"https://api.github.com/repos/StoDevX/AAO-React-Native/hooks","issue_events_url":"https://api.github.com/repos/StoDevX/AAO-React-Native/issues/events{/number}","events_url":"https://api.github.com/repos/StoDevX/AAO-React-Native/events","assignees_url":"https://api.github.com/repos/StoDevX/AAO-React-Native/assignees{/user}","branches_url":"https://api.github.com/repos/StoDevX/AAO-React-Native/branches{/branch}","tags_url":"https://api.github.com/repos/StoDevX/AAO-React-Native/tags","blobs_url":"https://api.github.com/repos/StoDevX/AAO-React-Native/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/StoDevX/AAO-React-Native/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/StoDevX/AAO-React-Native/git/refs{/sha}","trees_url":"https://api.github.com/repos/StoDevX/AAO-React-Native/git/trees{/sha}","statuses_url":"https://api.github.com/repos/StoDevX/AAO-React-Native/statuses/{sha}","languages_url":"https://api.github.com/repos/StoDevX/AAO-React-Native/languages","stargazers_url":"https://api.github.com/repos/StoDevX/AAO-React-Native/stargazers","contributors_url":"https://api.github.com/repos/StoDevX/AAO-React-Native/contributors","subscribers_url":"https://api.github.com/repos/StoDevX/AAO-React-Native/subscribers","subscription_url":"https://api.github.com/repos/StoDevX/AAO-React-Native/subscription","commits_url":"https://api.github.com/repos/StoDevX/AAO-React-Native/commits{/sha}","git_commits_url":"https://api.github.com/repos/StoDevX/AAO-React-Native/git/commits{/sha}","comments_url":"https://api.github.com/repos/StoDevX/AAO-React-Native/comments{/number}","issue_comment_url":"https://api.github.com/repos/StoDevX/AAO-React-Native/issues/comments{/number}","contents_url":"https://api.github.com/repos/StoDevX/AAO-React-Native/contents/{+path}","compare_url":"https://api.github.com/repos/StoDevX/AAO-React-Native/compare/{base}...{head}","merges_url":"https://api.github.com/repos/StoDevX/AAO-React-Native/merges","archive_url":"https://api.github.com/repos/StoDevX/AAO-React-Native/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/StoDevX/AAO-React-Native/downloads","issues_url":"https://api.github.com/repos/StoDevX/AAO-React-Native/issues{/number}","pulls_url":"https://api.github.com/repos/StoDevX/AAO-React-Native/pulls{/number}","milestones_url":"https://api.github.com/repos/StoDevX/AAO-React-Native/milestones{/number}","notifications_url":"https://api.github.com/repos/StoDevX/AAO-React-Native/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/StoDevX/AAO-React-Native/labels{/name}","releases_url":"https://api.github.com/repos/StoDevX/AAO-React-Native/releases{/id}","deployments_url":"https://api.github.com/repos/StoDevX/AAO-React-Native/deployments","created_at":"2015-12-22T06:41:01Z","updated_at":"2018-01-24T17:17:07Z","pushed_at":"2018-02-01T20:07:16Z","git_url":"git://github.com/StoDevX/AAO-React-Native.git","ssh_url":"git@github.com:StoDevX/AAO-React-Native.git","clone_url":"https://github.com/StoDevX/AAO-React-Native.git","svn_url":"https://github.com/StoDevX/AAO-React-Native","homepage":"","size":73357,"stargazers_count":20,"watchers_count":20,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":5,"mirror_url":null,"archived":false,"open_issues_count":58,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":5,"open_issues":58,"watchers":20,"default_branch":"master"}},"base":{"label":"StoDevX:master","ref":"master","sha":"3654688467de0a13f22d99571e96935913da1901","user":{"login":"StoDevX","id":16405322,"avatar_url":"https://avatars0.githubusercontent.com/u/16405322?v=4","gravatar_id":"","url":"https://api.github.com/users/StoDevX","html_url":"https://github.com/StoDevX","followers_url":"https://api.github.com/users/StoDevX/followers","following_url":"https://api.github.com/users/StoDevX/following{/other_user}","gists_url":"https://api.github.com/users/StoDevX/gists{/gist_id}","starred_url":"https://api.github.com/users/StoDevX/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/StoDevX/subscriptions","organizations_url":"https://api.github.com/users/StoDevX/orgs","repos_url":"https://api.github.com/users/StoDevX/repos","events_url":"https://api.github.com/users/StoDevX/events{/privacy}","received_events_url":"https://api.github.com/users/StoDevX/received_events","type":"Organization","site_admin":false},"repo":{"id":48415146,"name":"AAO-React-Native","full_name":"StoDevX/AAO-React-Native","owner":{"login":"StoDevX","id":16405322,"avatar_url":"https://avatars0.githubusercontent.com/u/16405322?v=4","gravatar_id":"","url":"https://api.github.com/users/StoDevX","html_url":"https://github.com/StoDevX","followers_url":"https://api.github.com/users/StoDevX/followers","following_url":"https://api.github.com/users/StoDevX/following{/other_user}","gists_url":"https://api.github.com/users/StoDevX/gists{/gist_id}","starred_url":"https://api.github.com/users/StoDevX/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/StoDevX/subscriptions","organizations_url":"https://api.github.com/users/StoDevX/orgs","repos_url":"https://api.github.com/users/StoDevX/repos","events_url":"https://api.github.com/users/StoDevX/events{/privacy}","received_events_url":"https://api.github.com/users/StoDevX/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/StoDevX/AAO-React-Native","description":"The St. Olaf community, now in pocket size.","fork":false,"url":"https://api.github.com/repos/StoDevX/AAO-React-Native","forks_url":"https://api.github.com/repos/StoDevX/AAO-React-Native/forks","keys_url":"https://api.github.com/repos/StoDevX/AAO-React-Native/keys{/key_id}","collaborators_url":"https://api.github.com/repos/StoDevX/AAO-React-Native/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/StoDevX/AAO-React-Native/teams","hooks_url":"https://api.github.com/repos/StoDevX/AAO-React-Native/hooks","issue_events_url":"https://api.github.com/repos/StoDevX/AAO-React-Native/issues/events{/number}","events_url":"https://api.github.com/repos/StoDevX/AAO-React-Native/events","assignees_url":"https://api.github.com/repos/StoDevX/AAO-React-Native/assignees{/user}","branches_url":"https://api.github.com/repos/StoDevX/AAO-React-Native/branches{/branch}","tags_url":"https://api.github.com/repos/StoDevX/AAO-React-Native/tags","blobs_url":"https://api.github.com/repos/StoDevX/AAO-React-Native/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/StoDevX/AAO-React-Native/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/StoDevX/AAO-React-Native/git/refs{/sha}","trees_url":"https://api.github.com/repos/StoDevX/AAO-React-Native/git/trees{/sha}","statuses_url":"https://api.github.com/repos/StoDevX/AAO-React-Native/statuses/{sha}","languages_url":"https://api.github.com/repos/StoDevX/AAO-React-Native/languages","stargazers_url":"https://api.github.com/repos/StoDevX/AAO-React-Native/stargazers","contributors_url":"https://api.github.com/repos/StoDevX/AAO-React-Native/contributors","subscribers_url":"https://api.github.com/repos/StoDevX/AAO-React-Native/subscribers","subscription_url":"https://api.github.com/repos/StoDevX/AAO-React-Native/subscription","commits_url":"https://api.github.com/repos/StoDevX/AAO-React-Native/commits{/sha}","git_commits_url":"https://api.github.com/repos/StoDevX/AAO-React-Native/git/commits{/sha}","comments_url":"https://api.github.com/repos/StoDevX/AAO-React-Native/comments{/number}","issue_comment_url":"https://api.github.com/repos/StoDevX/AAO-React-Native/issues/comments{/number}","contents_url":"https://api.github.com/repos/StoDevX/AAO-React-Native/contents/{+path}","compare_url":"https://api.github.com/repos/StoDevX/AAO-React-Native/compare/{base}...{head}","merges_url":"https://api.github.com/repos/StoDevX/AAO-React-Native/merges","archive_url":"https://api.github.com/repos/StoDevX/AAO-React-Native/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/StoDevX/AAO-React-Native/downloads","issues_url":"https://api.github.com/repos/StoDevX/AAO-React-Native/issues{/number}","pulls_url":"https://api.github.com/repos/StoDevX/AAO-React-Native/pulls{/number}","milestones_url":"https://api.github.com/repos/StoDevX/AAO-React-Native/milestones{/number}","notifications_url":"https://api.github.com/repos/StoDevX/AAO-React-Native/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/StoDevX/AAO-React-Native/labels{/name}","releases_url":"https://api.github.com/repos/StoDevX/AAO-React-Native/releases{/id}","deployments_url":"https://api.github.com/repos/StoDevX/AAO-React-Native/deployments","created_at":"2015-12-22T06:41:01Z","updated_at":"2018-01-24T17:17:07Z","pushed_at":"2018-02-01T20:07:16Z","git_url":"git://github.com/StoDevX/AAO-React-Native.git","ssh_url":"git@github.com:StoDevX/AAO-React-Native.git","clone_url":"https://github.com/StoDevX/AAO-React-Native.git","svn_url":"https://github.com/StoDevX/AAO-React-Native","homepage":"","size":73357,"stargazers_count":20,"watchers_count":20,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":5,"mirror_url":null,"archived":false,"open_issues_count":58,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":5,"open_issues":58,"watchers":20,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/StoDevX/AAO-React-Native/pulls/2293"},"html":{"href":"https://github.com/StoDevX/AAO-React-Native/pull/2293"},"issue":{"href":"https://api.github.com/repos/StoDevX/AAO-React-Native/issues/2293"},"comments":{"href":"https://api.github.com/repos/StoDevX/AAO-React-Native/issues/2293/comments"},"review_comments":{"href":"https://api.github.com/repos/StoDevX/AAO-React-Native/pulls/2293/comments"},"review_comment":{"href":"https://api.github.com/repos/StoDevX/AAO-React-Native/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/StoDevX/AAO-React-Native/pulls/2293/commits"},"statuses":{"href":"https://api.github.com/repos/StoDevX/AAO-React-Native/statuses/8e4cce5d17797e80a5fa6f394081a961b5e0bb9d"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"hawkrives"}}