{"action":"created","comment":{"url":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/pulls/comments/229085538","pull_request_review_id":169501651,"id":229085538,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyOTA4NTUzOA==","diff_hunk":"@@ -0,0 +1,83 @@\n+/*\n+ To test these queries, source heartbeat-insert-test.sql within the MySQL prompt\n+  and then source this file. You should compare the output of this file versus\n+  the expected results denoted in heartbeat-insert-test.sql. Note that the\n+  test uses CURRENT_TIMESTAMP and these queries also user CURRENT_TIMESTAMP,\n+  so it is important to run this query after inserting the test records because\n+  if you wait too long (4 min), then all machines will be returned as \n+  AVAILABLE (since all heartbeats have timed out w.r.t. CURRENT_TIMESTAMP\n+  of a later time) \n+*/\n+\n+\n+\n+/* Check the availability of a single machine (7 for this example) */\n+/* Assuming for Machine.Status that 0 is BROKEN, 1 is ALIVE */\n+SELECT","path":"cs411project/sql/check-machine-availability.sql","position":16,"original_position":16,"commit_id":"3ee97d4d9d528b44a00415c48767aa3008683d9d","original_commit_id":"3ee97d4d9d528b44a00415c48767aa3008683d9d","user":{"login":"MichaelRechenberg","id":13754529,"node_id":"MDQ6VXNlcjEzNzU0NTI5","avatar_url":"https://avatars3.githubusercontent.com/u/13754529?v=4","gravatar_id":"","url":"https://api.github.com/users/MichaelRechenberg","html_url":"https://github.com/MichaelRechenberg","followers_url":"https://api.github.com/users/MichaelRechenberg/followers","following_url":"https://api.github.com/users/MichaelRechenberg/following{/other_user}","gists_url":"https://api.github.com/users/MichaelRechenberg/gists{/gist_id}","starred_url":"https://api.github.com/users/MichaelRechenberg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MichaelRechenberg/subscriptions","organizations_url":"https://api.github.com/users/MichaelRechenberg/orgs","repos_url":"https://api.github.com/users/MichaelRechenberg/repos","events_url":"https://api.github.com/users/MichaelRechenberg/events{/privacy}","received_events_url":"https://api.github.com/users/MichaelRechenberg/received_events","type":"User","site_admin":false},"body":"For both the bulk and single-machine queries to check for availability, if there is no HeartbeatSequence row for a machine M, then the query returns BROKEN if the machine's status is BROKEN, otherwise the query returns AVAILABLE (which is what we want because if there is no HeartbeatSequence row for M, then no one has used the machine before). The three-valued Boolean logic works in our favor here","created_at":"2018-10-29T20:27:29Z","updated_at":"2018-10-29T20:27:29Z","html_url":"https://github.com/MichaelRechenberg/cs411webproject/pull/1#discussion_r229085538","pull_request_url":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/pulls/1","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/pulls/comments/229085538"},"html":{"href":"https://github.com/MichaelRechenberg/cs411webproject/pull/1#discussion_r229085538"},"pull_request":{"href":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/pulls/1","id":225413564,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI1NDEzNTY0","html_url":"https://github.com/MichaelRechenberg/cs411webproject/pull/1","diff_url":"https://github.com/MichaelRechenberg/cs411webproject/pull/1.diff","patch_url":"https://github.com/MichaelRechenberg/cs411webproject/pull/1.patch","issue_url":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/issues/1","number":1,"state":"open","locked":false,"title":"Check machine availability and location, DDL Changes, update requirements.txt for Flask-CORS","user":{"login":"MichaelRechenberg","id":13754529,"node_id":"MDQ6VXNlcjEzNzU0NTI5","avatar_url":"https://avatars3.githubusercontent.com/u/13754529?v=4","gravatar_id":"","url":"https://api.github.com/users/MichaelRechenberg","html_url":"https://github.com/MichaelRechenberg","followers_url":"https://api.github.com/users/MichaelRechenberg/followers","following_url":"https://api.github.com/users/MichaelRechenberg/following{/other_user}","gists_url":"https://api.github.com/users/MichaelRechenberg/gists{/gist_id}","starred_url":"https://api.github.com/users/MichaelRechenberg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MichaelRechenberg/subscriptions","organizations_url":"https://api.github.com/users/MichaelRechenberg/orgs","repos_url":"https://api.github.com/users/MichaelRechenberg/repos","events_url":"https://api.github.com/users/MichaelRechenberg/events{/privacy}","received_events_url":"https://api.github.com/users/MichaelRechenberg/received_events","type":"User","site_admin":false},"body":"# requirements.txt Changes\r\n\r\nAdded Flask-cors to enable CORS requests from AJAX on an app-wide level (later we can enable CORS requests on just a URL level via regex)\r\n\r\n# API Additions\r\n\r\n- GET /project/machine/availability\r\n  Returns a list of JSON objects where each JSON object has three keys. \"MachineID\" which is an integer representing the machine id, \"MachineAvailability\" which is a string that is either \"BROKEN\", \"IN-USE\", or \"AVAILABLE\" indicating the availability of that machine, and \"location\" which is a JSON object with \"x\" and \"y\" fields indicating the machine's location in the UI.\r\n- GET /project/machine/availability/<machine_id>\r\nReturn the availability of a machine with MachineID machine_id as a JSON object (with same fields as described in the above route). If no machine with MachineID machine_id exists in the database, an empty JSON object is returned\r\n\r\n\r\n**Note that the location being returned is being taken from a static dictionary of just 10 machines in constant.py right now...after the demo we can switch to having this location be queried (b/c the TAs will be able to drag and drop the locations of machines, and these new positions will have to be persisted on page reload)**\r\n\r\n# Tests\r\n\r\nThe SQL queries to check for machine availability used were manually tested using check-machine-availability.sql and heartbeat-insert-test.sql.\r\n\r\n\r\n# DDL Changes\r\n\r\nAdded IsResolved field to Comments\r\nAdded NumHeartbeats field to HeartbeatSequence\r\nLastTS of HeartbeatSequence is updated automatically on an UPDATE\r\nThe PK for Comments and HeartbeatSequence have AUTO_INCREMENT\r\n\r\n\r\nTo add a new HeartbeatSequence we can do the following (note we don't have to specify every fields...especially the PK...and some fields have defaults)\r\n    INSERT INTO HeartbeatSequence(Tfail, NetID, MachineID) VALUES ('00:05:00', 'some-net-id', 1);\r\n\r\nTo update a heartbeat sequence, we can just ++ the NumHeartbeats field for that HeartbeatSequence and LastTS will be updated automatically\r\n\r\n\r\n","created_at":"2018-10-24T13:55:53Z","updated_at":"2018-10-29T20:27:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"03f10d321303896c3aedd06624e9d65406b1d0c1","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/pulls/1/commits","review_comments_url":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/pulls/1/comments","review_comment_url":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/pulls/comments{/number}","comments_url":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/issues/1/comments","statuses_url":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/statuses/3ee97d4d9d528b44a00415c48767aa3008683d9d","head":{"label":"MichaelRechenberg:machine-avail","ref":"machine-avail","sha":"3ee97d4d9d528b44a00415c48767aa3008683d9d","user":{"login":"MichaelRechenberg","id":13754529,"node_id":"MDQ6VXNlcjEzNzU0NTI5","avatar_url":"https://avatars3.githubusercontent.com/u/13754529?v=4","gravatar_id":"","url":"https://api.github.com/users/MichaelRechenberg","html_url":"https://github.com/MichaelRechenberg","followers_url":"https://api.github.com/users/MichaelRechenberg/followers","following_url":"https://api.github.com/users/MichaelRechenberg/following{/other_user}","gists_url":"https://api.github.com/users/MichaelRechenberg/gists{/gist_id}","starred_url":"https://api.github.com/users/MichaelRechenberg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MichaelRechenberg/subscriptions","organizations_url":"https://api.github.com/users/MichaelRechenberg/orgs","repos_url":"https://api.github.com/users/MichaelRechenberg/repos","events_url":"https://api.github.com/users/MichaelRechenberg/events{/privacy}","received_events_url":"https://api.github.com/users/MichaelRechenberg/received_events","type":"User","site_admin":false},"repo":{"id":153714486,"node_id":"MDEwOlJlcG9zaXRvcnkxNTM3MTQ0ODY=","name":"cs411webproject","full_name":"MichaelRechenberg/cs411webproject","private":false,"owner":{"login":"MichaelRechenberg","id":13754529,"node_id":"MDQ6VXNlcjEzNzU0NTI5","avatar_url":"https://avatars3.githubusercontent.com/u/13754529?v=4","gravatar_id":"","url":"https://api.github.com/users/MichaelRechenberg","html_url":"https://github.com/MichaelRechenberg","followers_url":"https://api.github.com/users/MichaelRechenberg/followers","following_url":"https://api.github.com/users/MichaelRechenberg/following{/other_user}","gists_url":"https://api.github.com/users/MichaelRechenberg/gists{/gist_id}","starred_url":"https://api.github.com/users/MichaelRechenberg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MichaelRechenberg/subscriptions","organizations_url":"https://api.github.com/users/MichaelRechenberg/orgs","repos_url":"https://api.github.com/users/MichaelRechenberg/repos","events_url":"https://api.github.com/users/MichaelRechenberg/events{/privacy}","received_events_url":"https://api.github.com/users/MichaelRechenberg/received_events","type":"User","site_admin":false},"html_url":"https://github.com/MichaelRechenberg/cs411webproject","description":"Git repository for CS 411 (Database Systems) Database-Driven Web App","fork":false,"url":"https://api.github.com/repos/MichaelRechenberg/cs411webproject","forks_url":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/forks","keys_url":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/teams","hooks_url":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/hooks","issue_events_url":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/issues/events{/number}","events_url":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/events","assignees_url":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/assignees{/user}","branches_url":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/branches{/branch}","tags_url":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/tags","blobs_url":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/git/refs{/sha}","trees_url":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/statuses/{sha}","languages_url":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/languages","stargazers_url":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/stargazers","contributors_url":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/contributors","subscribers_url":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/subscribers","subscription_url":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/subscription","commits_url":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/commits{/sha}","git_commits_url":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/git/commits{/sha}","comments_url":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/comments{/number}","issue_comment_url":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/issues/comments{/number}","contents_url":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/contents/{+path}","compare_url":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/merges","archive_url":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/downloads","issues_url":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/issues{/number}","pulls_url":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/pulls{/number}","milestones_url":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/milestones{/number}","notifications_url":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/labels{/name}","releases_url":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/releases{/id}","deployments_url":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/deployments","created_at":"2018-10-19T02:19:55Z","updated_at":"2018-10-19T20:46:18Z","pushed_at":"2018-10-24T17:05:59Z","git_url":"git://github.com/MichaelRechenberg/cs411webproject.git","ssh_url":"git@github.com:MichaelRechenberg/cs411webproject.git","clone_url":"https://github.com/MichaelRechenberg/cs411webproject.git","svn_url":"https://github.com/MichaelRechenberg/cs411webproject","homepage":null,"size":30,"stargazers_count":0,"watchers_count":0,"language":"Python","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":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"MichaelRechenberg:master","ref":"master","sha":"b17e9a74685bb4bc0f02f27a894e14df32ce051f","user":{"login":"MichaelRechenberg","id":13754529,"node_id":"MDQ6VXNlcjEzNzU0NTI5","avatar_url":"https://avatars3.githubusercontent.com/u/13754529?v=4","gravatar_id":"","url":"https://api.github.com/users/MichaelRechenberg","html_url":"https://github.com/MichaelRechenberg","followers_url":"https://api.github.com/users/MichaelRechenberg/followers","following_url":"https://api.github.com/users/MichaelRechenberg/following{/other_user}","gists_url":"https://api.github.com/users/MichaelRechenberg/gists{/gist_id}","starred_url":"https://api.github.com/users/MichaelRechenberg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MichaelRechenberg/subscriptions","organizations_url":"https://api.github.com/users/MichaelRechenberg/orgs","repos_url":"https://api.github.com/users/MichaelRechenberg/repos","events_url":"https://api.github.com/users/MichaelRechenberg/events{/privacy}","received_events_url":"https://api.github.com/users/MichaelRechenberg/received_events","type":"User","site_admin":false},"repo":{"id":153714486,"node_id":"MDEwOlJlcG9zaXRvcnkxNTM3MTQ0ODY=","name":"cs411webproject","full_name":"MichaelRechenberg/cs411webproject","private":false,"owner":{"login":"MichaelRechenberg","id":13754529,"node_id":"MDQ6VXNlcjEzNzU0NTI5","avatar_url":"https://avatars3.githubusercontent.com/u/13754529?v=4","gravatar_id":"","url":"https://api.github.com/users/MichaelRechenberg","html_url":"https://github.com/MichaelRechenberg","followers_url":"https://api.github.com/users/MichaelRechenberg/followers","following_url":"https://api.github.com/users/MichaelRechenberg/following{/other_user}","gists_url":"https://api.github.com/users/MichaelRechenberg/gists{/gist_id}","starred_url":"https://api.github.com/users/MichaelRechenberg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MichaelRechenberg/subscriptions","organizations_url":"https://api.github.com/users/MichaelRechenberg/orgs","repos_url":"https://api.github.com/users/MichaelRechenberg/repos","events_url":"https://api.github.com/users/MichaelRechenberg/events{/privacy}","received_events_url":"https://api.github.com/users/MichaelRechenberg/received_events","type":"User","site_admin":false},"html_url":"https://github.com/MichaelRechenberg/cs411webproject","description":"Git repository for CS 411 (Database Systems) Database-Driven Web App","fork":false,"url":"https://api.github.com/repos/MichaelRechenberg/cs411webproject","forks_url":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/forks","keys_url":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/teams","hooks_url":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/hooks","issue_events_url":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/issues/events{/number}","events_url":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/events","assignees_url":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/assignees{/user}","branches_url":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/branches{/branch}","tags_url":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/tags","blobs_url":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/git/refs{/sha}","trees_url":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/statuses/{sha}","languages_url":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/languages","stargazers_url":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/stargazers","contributors_url":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/contributors","subscribers_url":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/subscribers","subscription_url":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/subscription","commits_url":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/commits{/sha}","git_commits_url":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/git/commits{/sha}","comments_url":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/comments{/number}","issue_comment_url":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/issues/comments{/number}","contents_url":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/contents/{+path}","compare_url":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/merges","archive_url":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/downloads","issues_url":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/issues{/number}","pulls_url":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/pulls{/number}","milestones_url":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/milestones{/number}","notifications_url":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/labels{/name}","releases_url":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/releases{/id}","deployments_url":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/deployments","created_at":"2018-10-19T02:19:55Z","updated_at":"2018-10-19T20:46:18Z","pushed_at":"2018-10-24T17:05:59Z","git_url":"git://github.com/MichaelRechenberg/cs411webproject.git","ssh_url":"git@github.com:MichaelRechenberg/cs411webproject.git","clone_url":"https://github.com/MichaelRechenberg/cs411webproject.git","svn_url":"https://github.com/MichaelRechenberg/cs411webproject","homepage":null,"size":30,"stargazers_count":0,"watchers_count":0,"language":"Python","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":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/pulls/1"},"html":{"href":"https://github.com/MichaelRechenberg/cs411webproject/pull/1"},"issue":{"href":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/issues/1"},"comments":{"href":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/MichaelRechenberg/cs411webproject/statuses/3ee97d4d9d528b44a00415c48767aa3008683d9d"}},"author_association":"OWNER"}}
{"actor":{"display_login":"MichaelRechenberg"}}