{"action":"created","comment":{"url":"https://api.github.com/repos/auvsi-suas/interop/pulls/comments/85466568","pull_request_review_id":6180909,"id":85466568,"diff_hunk":"@@ -0,0 +1,102 @@\n+import os\n+import sys\n+sys.path.append(\"../..\")\n+os.environ.setdefault(\"DJANGO_SETTINGS_MODULE\", \"server.settings\")\n+from django.core.wsgi import get_wsgi_application\n+get_wsgi_application()\n+\n+import argparse\n+import json\n+import auvsi_suas.models as models\n+\n+\n+def active_mission():\n+    '''Returns the current active mission - modified from views/mission.py'''\n+    missions = models.mission_config.MissionConfig.objects.filter(\n+        is_active=True)\n+    if len(missions) != 1:\n+        print('Error: Invalid number of active missions. Missions: %s.',\n+              str(missions))\n+        return None\n+\n+    return missions[0]\n+\n+\n+if __name__ == '__main__':\n+    parser = argparse.ArgumentParser(\n+        usage=\n+        'Edits an interop server mission to include the waypoints specified in a JSON. See the example JSON for reference\\nUse the --help flag for more information')\n+    parser.add_argument(\"json_file\",\n+                        help='The file to load the mission waypoints from')\n+    parser.add_argument(\n+        '--pk',\n+        type=int,\n+        default=0,\n+        help='Edit the specified pk rather than the currently active mission')\n+\n+    args = parser.parse_args()\n+\n+    # Read in JSON file\n+    try:\n+        with open(args.json_file) as f:\n+            wp_string = f.read()\n+    except IOError as e:\n+        print('Error: Could not read JSON file')\n+        print e\n+        sys.exit(1)\n+\n+    # Convert json string to list of waypoints\n+    try:\n+        waypoints = json.loads(wp_string)\n+    except ValueError:\n+        print('Error: File is not a valid json')\n+        sys.exit(1)\n+\n+    # Confirm all arguments are formatted correctly\n+    try:\n+        assert type(args.pk) == int\n+        assert type(waypoints) == list\n+        assert all(type(w) == dict and 'latitude' in w and 'longitude' in w and\n+                   'altitude_msl' in w for w in waypoints)\n+    except (KeyError, AssertionError) as e:\n+        print(\n+            'Error: JSON does not contain properly formatted fields or invalid pk format'\n+        )\n+        print e\n+        sys.exit(1)\n+\n+    # Get the mission object to edit\n+\n+    # If the pk is 0, edit the currently active mission\n+    if args.pk == 0:","path":"server/tools/waypoint_editor/edit_mission_waypoints.py","position":71,"original_position":71,"commit_id":"1f8739cc4c0a49be4c117279f619b5b2c8cd4075","original_commit_id":"1f8739cc4c0a49be4c117279f619b5b2c8cd4075","user":{"login":"prattmic","id":1293187,"avatar_url":"https://avatars.githubusercontent.com/u/1293187?v=3","gravatar_id":"","url":"https://api.github.com/users/prattmic","html_url":"https://github.com/prattmic","followers_url":"https://api.github.com/users/prattmic/followers","following_url":"https://api.github.com/users/prattmic/following{/other_user}","gists_url":"https://api.github.com/users/prattmic/gists{/gist_id}","starred_url":"https://api.github.com/users/prattmic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prattmic/subscriptions","organizations_url":"https://api.github.com/users/prattmic/orgs","repos_url":"https://api.github.com/users/prattmic/repos","events_url":"https://api.github.com/users/prattmic/events{/privacy}","received_events_url":"https://api.github.com/users/prattmic/received_events","type":"User","site_admin":false},"body":"`if args.pk is None`\r\n\r\nwith the comment above to change default to `None`.","created_at":"2016-10-28T03:20:59Z","updated_at":"2016-10-28T03:20:59Z","html_url":"https://github.com/auvsi-suas/interop/pull/202#discussion_r85466568","pull_request_url":"https://api.github.com/repos/auvsi-suas/interop/pulls/202","_links":{"self":{"href":"https://api.github.com/repos/auvsi-suas/interop/pulls/comments/85466568"},"html":{"href":"https://github.com/auvsi-suas/interop/pull/202#discussion_r85466568"},"pull_request":{"href":"https://api.github.com/repos/auvsi-suas/interop/pulls/202"}}},"pull_request":{"url":"https://api.github.com/repos/auvsi-suas/interop/pulls/202","id":91212654,"html_url":"https://github.com/auvsi-suas/interop/pull/202","diff_url":"https://github.com/auvsi-suas/interop/pull/202.diff","patch_url":"https://github.com/auvsi-suas/interop/pull/202.patch","issue_url":"https://api.github.com/repos/auvsi-suas/interop/issues/202","number":202,"state":"open","locked":false,"title":"Add waypoint automation script","user":{"login":"JamesSto","id":10344467,"avatar_url":"https://avatars.githubusercontent.com/u/10344467?v=3","gravatar_id":"","url":"https://api.github.com/users/JamesSto","html_url":"https://github.com/JamesSto","followers_url":"https://api.github.com/users/JamesSto/followers","following_url":"https://api.github.com/users/JamesSto/following{/other_user}","gists_url":"https://api.github.com/users/JamesSto/gists{/gist_id}","starred_url":"https://api.github.com/users/JamesSto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JamesSto/subscriptions","organizations_url":"https://api.github.com/users/JamesSto/orgs","repos_url":"https://api.github.com/users/JamesSto/repos","events_url":"https://api.github.com/users/JamesSto/events{/privacy}","received_events_url":"https://api.github.com/users/JamesSto/received_events","type":"User","site_admin":false},"body":"Modified the endpoint code slightly to be a local automation script instead. Changes waypoints in active mission or given mission PK to match the input JSON.","created_at":"2016-10-27T14:31:26Z","updated_at":"2016-10-28T03:43:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"41be016bc69a73ebed666450dafffe08f29e7988","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/auvsi-suas/interop/pulls/202/commits","review_comments_url":"https://api.github.com/repos/auvsi-suas/interop/pulls/202/comments","review_comment_url":"https://api.github.com/repos/auvsi-suas/interop/pulls/comments{/number}","comments_url":"https://api.github.com/repos/auvsi-suas/interop/issues/202/comments","statuses_url":"https://api.github.com/repos/auvsi-suas/interop/statuses/1f8739cc4c0a49be4c117279f619b5b2c8cd4075","head":{"label":"JamesSto:waypoint_automation","ref":"waypoint_automation","sha":"1f8739cc4c0a49be4c117279f619b5b2c8cd4075","user":{"login":"JamesSto","id":10344467,"avatar_url":"https://avatars.githubusercontent.com/u/10344467?v=3","gravatar_id":"","url":"https://api.github.com/users/JamesSto","html_url":"https://github.com/JamesSto","followers_url":"https://api.github.com/users/JamesSto/followers","following_url":"https://api.github.com/users/JamesSto/following{/other_user}","gists_url":"https://api.github.com/users/JamesSto/gists{/gist_id}","starred_url":"https://api.github.com/users/JamesSto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JamesSto/subscriptions","organizations_url":"https://api.github.com/users/JamesSto/orgs","repos_url":"https://api.github.com/users/JamesSto/repos","events_url":"https://api.github.com/users/JamesSto/events{/privacy}","received_events_url":"https://api.github.com/users/JamesSto/received_events","type":"User","site_admin":false},"repo":{"id":71492589,"name":"interop","full_name":"JamesSto/interop","owner":{"login":"JamesSto","id":10344467,"avatar_url":"https://avatars.githubusercontent.com/u/10344467?v=3","gravatar_id":"","url":"https://api.github.com/users/JamesSto","html_url":"https://github.com/JamesSto","followers_url":"https://api.github.com/users/JamesSto/followers","following_url":"https://api.github.com/users/JamesSto/following{/other_user}","gists_url":"https://api.github.com/users/JamesSto/gists{/gist_id}","starred_url":"https://api.github.com/users/JamesSto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JamesSto/subscriptions","organizations_url":"https://api.github.com/users/JamesSto/orgs","repos_url":"https://api.github.com/users/JamesSto/repos","events_url":"https://api.github.com/users/JamesSto/events{/privacy}","received_events_url":"https://api.github.com/users/JamesSto/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/JamesSto/interop","description":"Interoperability System for the AUVSI SUAS Competition.","fork":true,"url":"https://api.github.com/repos/JamesSto/interop","forks_url":"https://api.github.com/repos/JamesSto/interop/forks","keys_url":"https://api.github.com/repos/JamesSto/interop/keys{/key_id}","collaborators_url":"https://api.github.com/repos/JamesSto/interop/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/JamesSto/interop/teams","hooks_url":"https://api.github.com/repos/JamesSto/interop/hooks","issue_events_url":"https://api.github.com/repos/JamesSto/interop/issues/events{/number}","events_url":"https://api.github.com/repos/JamesSto/interop/events","assignees_url":"https://api.github.com/repos/JamesSto/interop/assignees{/user}","branches_url":"https://api.github.com/repos/JamesSto/interop/branches{/branch}","tags_url":"https://api.github.com/repos/JamesSto/interop/tags","blobs_url":"https://api.github.com/repos/JamesSto/interop/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/JamesSto/interop/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/JamesSto/interop/git/refs{/sha}","trees_url":"https://api.github.com/repos/JamesSto/interop/git/trees{/sha}","statuses_url":"https://api.github.com/repos/JamesSto/interop/statuses/{sha}","languages_url":"https://api.github.com/repos/JamesSto/interop/languages","stargazers_url":"https://api.github.com/repos/JamesSto/interop/stargazers","contributors_url":"https://api.github.com/repos/JamesSto/interop/contributors","subscribers_url":"https://api.github.com/repos/JamesSto/interop/subscribers","subscription_url":"https://api.github.com/repos/JamesSto/interop/subscription","commits_url":"https://api.github.com/repos/JamesSto/interop/commits{/sha}","git_commits_url":"https://api.github.com/repos/JamesSto/interop/git/commits{/sha}","comments_url":"https://api.github.com/repos/JamesSto/interop/comments{/number}","issue_comment_url":"https://api.github.com/repos/JamesSto/interop/issues/comments{/number}","contents_url":"https://api.github.com/repos/JamesSto/interop/contents/{+path}","compare_url":"https://api.github.com/repos/JamesSto/interop/compare/{base}...{head}","merges_url":"https://api.github.com/repos/JamesSto/interop/merges","archive_url":"https://api.github.com/repos/JamesSto/interop/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/JamesSto/interop/downloads","issues_url":"https://api.github.com/repos/JamesSto/interop/issues{/number}","pulls_url":"https://api.github.com/repos/JamesSto/interop/pulls{/number}","milestones_url":"https://api.github.com/repos/JamesSto/interop/milestones{/number}","notifications_url":"https://api.github.com/repos/JamesSto/interop/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/JamesSto/interop/labels{/name}","releases_url":"https://api.github.com/repos/JamesSto/interop/releases{/id}","deployments_url":"https://api.github.com/repos/JamesSto/interop/deployments","created_at":"2016-10-20T18:32:55Z","updated_at":"2016-10-26T23:41:45Z","pushed_at":"2016-10-26T23:55:08Z","git_url":"git://github.com/JamesSto/interop.git","ssh_url":"git@github.com:JamesSto/interop.git","clone_url":"https://github.com/JamesSto/interop.git","svn_url":"https://github.com/JamesSto/interop","homepage":null,"size":49302,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","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":"master"}},"base":{"label":"auvsi-suas:master","ref":"master","sha":"f4b830de89d64e9340d113520a08c45e4db19e54","user":{"login":"auvsi-suas","id":13365550,"avatar_url":"https://avatars.githubusercontent.com/u/13365550?v=3","gravatar_id":"","url":"https://api.github.com/users/auvsi-suas","html_url":"https://github.com/auvsi-suas","followers_url":"https://api.github.com/users/auvsi-suas/followers","following_url":"https://api.github.com/users/auvsi-suas/following{/other_user}","gists_url":"https://api.github.com/users/auvsi-suas/gists{/gist_id}","starred_url":"https://api.github.com/users/auvsi-suas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/auvsi-suas/subscriptions","organizations_url":"https://api.github.com/users/auvsi-suas/orgs","repos_url":"https://api.github.com/users/auvsi-suas/repos","events_url":"https://api.github.com/users/auvsi-suas/events{/privacy}","received_events_url":"https://api.github.com/users/auvsi-suas/received_events","type":"Organization","site_admin":false},"repo":{"id":42521702,"name":"interop","full_name":"auvsi-suas/interop","owner":{"login":"auvsi-suas","id":13365550,"avatar_url":"https://avatars.githubusercontent.com/u/13365550?v=3","gravatar_id":"","url":"https://api.github.com/users/auvsi-suas","html_url":"https://github.com/auvsi-suas","followers_url":"https://api.github.com/users/auvsi-suas/followers","following_url":"https://api.github.com/users/auvsi-suas/following{/other_user}","gists_url":"https://api.github.com/users/auvsi-suas/gists{/gist_id}","starred_url":"https://api.github.com/users/auvsi-suas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/auvsi-suas/subscriptions","organizations_url":"https://api.github.com/users/auvsi-suas/orgs","repos_url":"https://api.github.com/users/auvsi-suas/repos","events_url":"https://api.github.com/users/auvsi-suas/events{/privacy}","received_events_url":"https://api.github.com/users/auvsi-suas/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/auvsi-suas/interop","description":"Interoperability System for the AUVSI SUAS Competition.","fork":false,"url":"https://api.github.com/repos/auvsi-suas/interop","forks_url":"https://api.github.com/repos/auvsi-suas/interop/forks","keys_url":"https://api.github.com/repos/auvsi-suas/interop/keys{/key_id}","collaborators_url":"https://api.github.com/repos/auvsi-suas/interop/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/auvsi-suas/interop/teams","hooks_url":"https://api.github.com/repos/auvsi-suas/interop/hooks","issue_events_url":"https://api.github.com/repos/auvsi-suas/interop/issues/events{/number}","events_url":"https://api.github.com/repos/auvsi-suas/interop/events","assignees_url":"https://api.github.com/repos/auvsi-suas/interop/assignees{/user}","branches_url":"https://api.github.com/repos/auvsi-suas/interop/branches{/branch}","tags_url":"https://api.github.com/repos/auvsi-suas/interop/tags","blobs_url":"https://api.github.com/repos/auvsi-suas/interop/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/auvsi-suas/interop/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/auvsi-suas/interop/git/refs{/sha}","trees_url":"https://api.github.com/repos/auvsi-suas/interop/git/trees{/sha}","statuses_url":"https://api.github.com/repos/auvsi-suas/interop/statuses/{sha}","languages_url":"https://api.github.com/repos/auvsi-suas/interop/languages","stargazers_url":"https://api.github.com/repos/auvsi-suas/interop/stargazers","contributors_url":"https://api.github.com/repos/auvsi-suas/interop/contributors","subscribers_url":"https://api.github.com/repos/auvsi-suas/interop/subscribers","subscription_url":"https://api.github.com/repos/auvsi-suas/interop/subscription","commits_url":"https://api.github.com/repos/auvsi-suas/interop/commits{/sha}","git_commits_url":"https://api.github.com/repos/auvsi-suas/interop/git/commits{/sha}","comments_url":"https://api.github.com/repos/auvsi-suas/interop/comments{/number}","issue_comment_url":"https://api.github.com/repos/auvsi-suas/interop/issues/comments{/number}","contents_url":"https://api.github.com/repos/auvsi-suas/interop/contents/{+path}","compare_url":"https://api.github.com/repos/auvsi-suas/interop/compare/{base}...{head}","merges_url":"https://api.github.com/repos/auvsi-suas/interop/merges","archive_url":"https://api.github.com/repos/auvsi-suas/interop/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/auvsi-suas/interop/downloads","issues_url":"https://api.github.com/repos/auvsi-suas/interop/issues{/number}","pulls_url":"https://api.github.com/repos/auvsi-suas/interop/pulls{/number}","milestones_url":"https://api.github.com/repos/auvsi-suas/interop/milestones{/number}","notifications_url":"https://api.github.com/repos/auvsi-suas/interop/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/auvsi-suas/interop/labels{/name}","releases_url":"https://api.github.com/repos/auvsi-suas/interop/releases{/id}","deployments_url":"https://api.github.com/repos/auvsi-suas/interop/deployments","created_at":"2015-09-15T13:38:54Z","updated_at":"2016-10-22T18:00:46Z","pushed_at":"2016-10-27T14:31:26Z","git_url":"git://github.com/auvsi-suas/interop.git","ssh_url":"git@github.com:auvsi-suas/interop.git","clone_url":"https://github.com/auvsi-suas/interop.git","svn_url":"https://github.com/auvsi-suas/interop","homepage":null,"size":49312,"stargazers_count":29,"watchers_count":29,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":25,"mirror_url":null,"open_issues_count":5,"forks":25,"open_issues":5,"watchers":29,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/auvsi-suas/interop/pulls/202"},"html":{"href":"https://github.com/auvsi-suas/interop/pull/202"},"issue":{"href":"https://api.github.com/repos/auvsi-suas/interop/issues/202"},"comments":{"href":"https://api.github.com/repos/auvsi-suas/interop/issues/202/comments"},"review_comments":{"href":"https://api.github.com/repos/auvsi-suas/interop/pulls/202/comments"},"review_comment":{"href":"https://api.github.com/repos/auvsi-suas/interop/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/auvsi-suas/interop/pulls/202/commits"},"statuses":{"href":"https://api.github.com/repos/auvsi-suas/interop/statuses/1f8739cc4c0a49be4c117279f619b5b2c8cd4075"}}}}
{"actor":{"display_login":"prattmic"}}