{"action":"created","comment":{"url":"https://api.github.com/repos/cornell-dti/office-hours/pulls/comments/177979770","pull_request_review_id":107955870,"id":177979770,"diff_hunk":"@@ -1,60 +1,150 @@\n import * as React from 'react';\n import CalendarSessionCard from './CalendarSessionCard';\n \n-class CalendarSessions extends React.Component {\n+import gql from 'graphql-tag';\n+import { graphql } from 'react-apollo';\n+import { ChildProps } from 'react-apollo';\n \n-    props: {\n-        todayEpoch: number\n-    };\n+const QUERY = gql`\n+query FindSessionsByCourse($courseId: Int!, $beginTime: Datetime!, $endTime: Datetime!) {\n+    searchSessionRange(course: $courseId, begintime: $beginTime, endtime: $endTime) {\n+        nodes {\n+            sessionSeryBySessionSeriesId {\n+                location\n+                sessionSeriesTasBySessionSeriesId {\n+                nodes {\n+                    userByUserId {\n+                    firstName\n+                    lastName\n+                    }\n+                }\n+                }\n+            }\n+            sessionId\n+            startTime\n+            endTime\n+            location\n+            sessionTasBySessionId {\n+                nodes {\n+                    userByUserId {\n+                        firstName\n+                        lastName\n+                    }\n+                }\n+            }\n+        }\n+    }\n+}\n+`;\n+\n+const withData = graphql<Response, InputProps>(QUERY, {\n+    options: ({ beginTime, endTime, match }) => ({\n+        variables: {\n+            courseId: match.params.courseId,\n+            beginTime: beginTime,\n+            endTime: endTime\n+        }\n+    })\n+});\n+\n+type InputProps = {\n+    useFakeData: boolean,\n+    match: {\n+        params: {\n+            courseId: number,\n+        },\n+    },\n+    beginTime: Date,\n+    endTime: Date,\n+    data: {\n+        searchSessionRange?: {\n+            nodes: [{}]\n+        },\n+    },\n+};\n \n+class CalendarSessions extends React.Component<ChildProps<InputProps, Response>> {\n     render() {\n-        var nowTs = -1;\n-        // if (process.env.NODE_ENV !== 'production') {\n-        // For testing purposes only \n-        if (true) {\n-            nowTs = Math.round(Date.now() / 1000);\n+        var sessions: Session[] = [];\n+        if (this.props.data.searchSessionRange !== undefined) {\n+            if (this.props.data.searchSessionRange !== null) {\n+                this.props.data.searchSessionRange.nodes.forEach((node: SessionNode) => {\n+                    var tas: string[] = [];\n+                    if (node.sessionTasBySessionId !== undefined) {\n+                        node.sessionTasBySessionId.nodes.forEach(ta => {\n+                            tas.push(ta.userByUserId.firstName + ' ' + ta.userByUserId.lastName);\n+                        });\n+                    }\n+                    if (node.sessionSeryBySessionSeriesId.sessionSeriesTasBySessionSeriesId.nodes !== undefined\n+                        && tas.length === 0) {\n+                        node.sessionSeryBySessionSeriesId.sessionSeriesTasBySessionSeriesId.nodes.forEach(ta => {\n+                            tas.push(ta.userByUserId.firstName + ' ' + ta.userByUserId.lastName);","path":"client/src/components/includes/CalendarSessions.tsx","position":90,"original_position":90,"commit_id":"f6be05eb65823d96f451cbf0bf2e2b83b1717d33","original_commit_id":"f6be05eb65823d96f451cbf0bf2e2b83b1717d33","user":{"login":"karunsingh","id":5836923,"avatar_url":"https://avatars3.githubusercontent.com/u/5836923?v=4","gravatar_id":"","url":"https://api.github.com/users/karunsingh","html_url":"https://github.com/karunsingh","followers_url":"https://api.github.com/users/karunsingh/followers","following_url":"https://api.github.com/users/karunsingh/following{/other_user}","gists_url":"https://api.github.com/users/karunsingh/gists{/gist_id}","starred_url":"https://api.github.com/users/karunsingh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/karunsingh/subscriptions","organizations_url":"https://api.github.com/users/karunsingh/orgs","repos_url":"https://api.github.com/users/karunsingh/repos","events_url":"https://api.github.com/users/karunsingh/events{/privacy}","received_events_url":"https://api.github.com/users/karunsingh/received_events","type":"User","site_admin":false},"body":"Might be cleaner with `map`, like this:\r\n`tas = node.sessionSeryBySessionSeriesId.sessionSeriesTasBySessionSeriesId.nodes.map(ta => ta.userByUserId.firstName + ' ' + ta.userByUserId.lastName);`\r\nIn retrospect, looks like an unavoidable mess either way 🙃 ","created_at":"2018-03-29T08:04:52Z","updated_at":"2018-03-29T08:04:52Z","html_url":"https://github.com/cornell-dti/office-hours/pull/42#discussion_r177979770","pull_request_url":"https://api.github.com/repos/cornell-dti/office-hours/pulls/42","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/cornell-dti/office-hours/pulls/comments/177979770"},"html":{"href":"https://github.com/cornell-dti/office-hours/pull/42#discussion_r177979770"},"pull_request":{"href":"https://api.github.com/repos/cornell-dti/office-hours/pulls/42"}}},"pull_request":{"url":"https://api.github.com/repos/cornell-dti/office-hours/pulls/42","id":174255445,"html_url":"https://github.com/cornell-dti/office-hours/pull/42","diff_url":"https://github.com/cornell-dti/office-hours/pull/42.diff","patch_url":"https://github.com/cornell-dti/office-hours/pull/42.patch","issue_url":"https://api.github.com/repos/cornell-dti/office-hours/issues/42","number":42,"state":"open","locked":false,"title":"Integrate Apollo Client","user":{"login":"Glitched","id":1189255,"avatar_url":"https://avatars0.githubusercontent.com/u/1189255?v=4","gravatar_id":"","url":"https://api.github.com/users/Glitched","html_url":"https://github.com/Glitched","followers_url":"https://api.github.com/users/Glitched/followers","following_url":"https://api.github.com/users/Glitched/following{/other_user}","gists_url":"https://api.github.com/users/Glitched/gists{/gist_id}","starred_url":"https://api.github.com/users/Glitched/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Glitched/subscriptions","organizations_url":"https://api.github.com/users/Glitched/orgs","repos_url":"https://api.github.com/users/Glitched/repos","events_url":"https://api.github.com/users/Glitched/events{/privacy}","received_events_url":"https://api.github.com/users/Glitched/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-03-12T01:29:20Z","updated_at":"2018-03-29T08:04:52Z","closed_at":null,"merged_at":null,"merge_commit_sha":"80de61beba03b12da7f20366fa38166da93e3f98","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/cornell-dti/office-hours/pulls/42/commits","review_comments_url":"https://api.github.com/repos/cornell-dti/office-hours/pulls/42/comments","review_comment_url":"https://api.github.com/repos/cornell-dti/office-hours/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cornell-dti/office-hours/issues/42/comments","statuses_url":"https://api.github.com/repos/cornell-dti/office-hours/statuses/f6be05eb65823d96f451cbf0bf2e2b83b1717d33","head":{"label":"cornell-dti:apollo-client","ref":"apollo-client","sha":"f6be05eb65823d96f451cbf0bf2e2b83b1717d33","user":{"login":"cornell-dti","id":19356609,"avatar_url":"https://avatars2.githubusercontent.com/u/19356609?v=4","gravatar_id":"","url":"https://api.github.com/users/cornell-dti","html_url":"https://github.com/cornell-dti","followers_url":"https://api.github.com/users/cornell-dti/followers","following_url":"https://api.github.com/users/cornell-dti/following{/other_user}","gists_url":"https://api.github.com/users/cornell-dti/gists{/gist_id}","starred_url":"https://api.github.com/users/cornell-dti/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cornell-dti/subscriptions","organizations_url":"https://api.github.com/users/cornell-dti/orgs","repos_url":"https://api.github.com/users/cornell-dti/repos","events_url":"https://api.github.com/users/cornell-dti/events{/privacy}","received_events_url":"https://api.github.com/users/cornell-dti/received_events","type":"Organization","site_admin":false},"repo":{"id":110390711,"name":"office-hours","full_name":"cornell-dti/office-hours","owner":{"login":"cornell-dti","id":19356609,"avatar_url":"https://avatars2.githubusercontent.com/u/19356609?v=4","gravatar_id":"","url":"https://api.github.com/users/cornell-dti","html_url":"https://github.com/cornell-dti","followers_url":"https://api.github.com/users/cornell-dti/followers","following_url":"https://api.github.com/users/cornell-dti/following{/other_user}","gists_url":"https://api.github.com/users/cornell-dti/gists{/gist_id}","starred_url":"https://api.github.com/users/cornell-dti/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cornell-dti/subscriptions","organizations_url":"https://api.github.com/users/cornell-dti/orgs","repos_url":"https://api.github.com/users/cornell-dti/repos","events_url":"https://api.github.com/users/cornell-dti/events{/privacy}","received_events_url":"https://api.github.com/users/cornell-dti/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cornell-dti/office-hours","description":null,"fork":false,"url":"https://api.github.com/repos/cornell-dti/office-hours","forks_url":"https://api.github.com/repos/cornell-dti/office-hours/forks","keys_url":"https://api.github.com/repos/cornell-dti/office-hours/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cornell-dti/office-hours/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cornell-dti/office-hours/teams","hooks_url":"https://api.github.com/repos/cornell-dti/office-hours/hooks","issue_events_url":"https://api.github.com/repos/cornell-dti/office-hours/issues/events{/number}","events_url":"https://api.github.com/repos/cornell-dti/office-hours/events","assignees_url":"https://api.github.com/repos/cornell-dti/office-hours/assignees{/user}","branches_url":"https://api.github.com/repos/cornell-dti/office-hours/branches{/branch}","tags_url":"https://api.github.com/repos/cornell-dti/office-hours/tags","blobs_url":"https://api.github.com/repos/cornell-dti/office-hours/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cornell-dti/office-hours/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cornell-dti/office-hours/git/refs{/sha}","trees_url":"https://api.github.com/repos/cornell-dti/office-hours/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cornell-dti/office-hours/statuses/{sha}","languages_url":"https://api.github.com/repos/cornell-dti/office-hours/languages","stargazers_url":"https://api.github.com/repos/cornell-dti/office-hours/stargazers","contributors_url":"https://api.github.com/repos/cornell-dti/office-hours/contributors","subscribers_url":"https://api.github.com/repos/cornell-dti/office-hours/subscribers","subscription_url":"https://api.github.com/repos/cornell-dti/office-hours/subscription","commits_url":"https://api.github.com/repos/cornell-dti/office-hours/commits{/sha}","git_commits_url":"https://api.github.com/repos/cornell-dti/office-hours/git/commits{/sha}","comments_url":"https://api.github.com/repos/cornell-dti/office-hours/comments{/number}","issue_comment_url":"https://api.github.com/repos/cornell-dti/office-hours/issues/comments{/number}","contents_url":"https://api.github.com/repos/cornell-dti/office-hours/contents/{+path}","compare_url":"https://api.github.com/repos/cornell-dti/office-hours/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cornell-dti/office-hours/merges","archive_url":"https://api.github.com/repos/cornell-dti/office-hours/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cornell-dti/office-hours/downloads","issues_url":"https://api.github.com/repos/cornell-dti/office-hours/issues{/number}","pulls_url":"https://api.github.com/repos/cornell-dti/office-hours/pulls{/number}","milestones_url":"https://api.github.com/repos/cornell-dti/office-hours/milestones{/number}","notifications_url":"https://api.github.com/repos/cornell-dti/office-hours/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cornell-dti/office-hours/labels{/name}","releases_url":"https://api.github.com/repos/cornell-dti/office-hours/releases{/id}","deployments_url":"https://api.github.com/repos/cornell-dti/office-hours/deployments","created_at":"2017-11-12T00:06:57Z","updated_at":"2018-03-29T07:43:38Z","pushed_at":"2018-03-29T07:43:39Z","git_url":"git://github.com/cornell-dti/office-hours.git","ssh_url":"git@github.com:cornell-dti/office-hours.git","clone_url":"https://github.com/cornell-dti/office-hours.git","svn_url":"https://github.com/cornell-dti/office-hours","homepage":null,"size":2673,"stargazers_count":3,"watchers_count":3,"language":"TypeScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":null,"forks":0,"open_issues":1,"watchers":3,"default_branch":"master"}},"base":{"label":"cornell-dti:master","ref":"master","sha":"8e458b68da48b2494f745b73fab7653dacb98edb","user":{"login":"cornell-dti","id":19356609,"avatar_url":"https://avatars2.githubusercontent.com/u/19356609?v=4","gravatar_id":"","url":"https://api.github.com/users/cornell-dti","html_url":"https://github.com/cornell-dti","followers_url":"https://api.github.com/users/cornell-dti/followers","following_url":"https://api.github.com/users/cornell-dti/following{/other_user}","gists_url":"https://api.github.com/users/cornell-dti/gists{/gist_id}","starred_url":"https://api.github.com/users/cornell-dti/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cornell-dti/subscriptions","organizations_url":"https://api.github.com/users/cornell-dti/orgs","repos_url":"https://api.github.com/users/cornell-dti/repos","events_url":"https://api.github.com/users/cornell-dti/events{/privacy}","received_events_url":"https://api.github.com/users/cornell-dti/received_events","type":"Organization","site_admin":false},"repo":{"id":110390711,"name":"office-hours","full_name":"cornell-dti/office-hours","owner":{"login":"cornell-dti","id":19356609,"avatar_url":"https://avatars2.githubusercontent.com/u/19356609?v=4","gravatar_id":"","url":"https://api.github.com/users/cornell-dti","html_url":"https://github.com/cornell-dti","followers_url":"https://api.github.com/users/cornell-dti/followers","following_url":"https://api.github.com/users/cornell-dti/following{/other_user}","gists_url":"https://api.github.com/users/cornell-dti/gists{/gist_id}","starred_url":"https://api.github.com/users/cornell-dti/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cornell-dti/subscriptions","organizations_url":"https://api.github.com/users/cornell-dti/orgs","repos_url":"https://api.github.com/users/cornell-dti/repos","events_url":"https://api.github.com/users/cornell-dti/events{/privacy}","received_events_url":"https://api.github.com/users/cornell-dti/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cornell-dti/office-hours","description":null,"fork":false,"url":"https://api.github.com/repos/cornell-dti/office-hours","forks_url":"https://api.github.com/repos/cornell-dti/office-hours/forks","keys_url":"https://api.github.com/repos/cornell-dti/office-hours/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cornell-dti/office-hours/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cornell-dti/office-hours/teams","hooks_url":"https://api.github.com/repos/cornell-dti/office-hours/hooks","issue_events_url":"https://api.github.com/repos/cornell-dti/office-hours/issues/events{/number}","events_url":"https://api.github.com/repos/cornell-dti/office-hours/events","assignees_url":"https://api.github.com/repos/cornell-dti/office-hours/assignees{/user}","branches_url":"https://api.github.com/repos/cornell-dti/office-hours/branches{/branch}","tags_url":"https://api.github.com/repos/cornell-dti/office-hours/tags","blobs_url":"https://api.github.com/repos/cornell-dti/office-hours/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cornell-dti/office-hours/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cornell-dti/office-hours/git/refs{/sha}","trees_url":"https://api.github.com/repos/cornell-dti/office-hours/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cornell-dti/office-hours/statuses/{sha}","languages_url":"https://api.github.com/repos/cornell-dti/office-hours/languages","stargazers_url":"https://api.github.com/repos/cornell-dti/office-hours/stargazers","contributors_url":"https://api.github.com/repos/cornell-dti/office-hours/contributors","subscribers_url":"https://api.github.com/repos/cornell-dti/office-hours/subscribers","subscription_url":"https://api.github.com/repos/cornell-dti/office-hours/subscription","commits_url":"https://api.github.com/repos/cornell-dti/office-hours/commits{/sha}","git_commits_url":"https://api.github.com/repos/cornell-dti/office-hours/git/commits{/sha}","comments_url":"https://api.github.com/repos/cornell-dti/office-hours/comments{/number}","issue_comment_url":"https://api.github.com/repos/cornell-dti/office-hours/issues/comments{/number}","contents_url":"https://api.github.com/repos/cornell-dti/office-hours/contents/{+path}","compare_url":"https://api.github.com/repos/cornell-dti/office-hours/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cornell-dti/office-hours/merges","archive_url":"https://api.github.com/repos/cornell-dti/office-hours/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cornell-dti/office-hours/downloads","issues_url":"https://api.github.com/repos/cornell-dti/office-hours/issues{/number}","pulls_url":"https://api.github.com/repos/cornell-dti/office-hours/pulls{/number}","milestones_url":"https://api.github.com/repos/cornell-dti/office-hours/milestones{/number}","notifications_url":"https://api.github.com/repos/cornell-dti/office-hours/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cornell-dti/office-hours/labels{/name}","releases_url":"https://api.github.com/repos/cornell-dti/office-hours/releases{/id}","deployments_url":"https://api.github.com/repos/cornell-dti/office-hours/deployments","created_at":"2017-11-12T00:06:57Z","updated_at":"2018-03-29T07:43:38Z","pushed_at":"2018-03-29T07:43:39Z","git_url":"git://github.com/cornell-dti/office-hours.git","ssh_url":"git@github.com:cornell-dti/office-hours.git","clone_url":"https://github.com/cornell-dti/office-hours.git","svn_url":"https://github.com/cornell-dti/office-hours","homepage":null,"size":2673,"stargazers_count":3,"watchers_count":3,"language":"TypeScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":null,"forks":0,"open_issues":1,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cornell-dti/office-hours/pulls/42"},"html":{"href":"https://github.com/cornell-dti/office-hours/pull/42"},"issue":{"href":"https://api.github.com/repos/cornell-dti/office-hours/issues/42"},"comments":{"href":"https://api.github.com/repos/cornell-dti/office-hours/issues/42/comments"},"review_comments":{"href":"https://api.github.com/repos/cornell-dti/office-hours/pulls/42/comments"},"review_comment":{"href":"https://api.github.com/repos/cornell-dti/office-hours/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cornell-dti/office-hours/pulls/42/commits"},"statuses":{"href":"https://api.github.com/repos/cornell-dti/office-hours/statuses/f6be05eb65823d96f451cbf0bf2e2b83b1717d33"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"karunsingh"}}