{"action":"created","comment":{"url":"https://api.github.com/repos/rice-apps/wellbeing-app/pulls/comments/25562954","id":25562954,"diff_hunk":"@@ -0,0 +1,78 @@\n+import sqlite3 as lite\n+import uuid\n+from flask import Flask, request, session, g, redirect, url_for, abort, render_template, flash, jsonify\n+from flask_cas import CAS\n+\n+app = Flask(__name__)\n+app.config.from_object('config')\n+app.config['CAS_SERVER'] = 'https://netid.rice.edu'\n+app.config['CAS_AFTER_LOGIN'] = 'after_login'\n+app.config['APP_URL'] = 'localhost:5000'\n+app.config.setdefault('CAS_USERNAME_SESSION_KEY', 'CAS_USERNAME')\n+CAS(app)\n+\n+\n+def make_dicts(cursor, row):\n+    return dict((cursor.description[idx][0], value) for idx, value in enumerate(row))\n+\n+con = lite.connect(\"wellbeing.db\", check_same_thread=False)\n+con.row_factory = make_dicts\n+cur = con.cursor()\n+\n+\n+#get the database\n+def get_db():\n+    if not hasattr(g, 'sqlite_db'):\n+        g.sqlite_db = con\n+    return g.sqlite_db\n+\n+\n+#close the database if there is an error\n+@app.teardown_appcontext\n+def close_db(error):\n+    if hasattr(g, 'sqlite_db'):\n+        g.sqlite_db.close()\n+\n+\n+#return a dictionary of numbers and information about wellbeing resources\n+@app.route(\"/api/numbers\")\n+def get_numbers():\n+    cur.execute(\"\"\"SELECT * FROM important_numbers\"\"\")\n+    result = {\"result\": cur.fetchall()}\n+    return jsonify(result)\n+\n+\n+def add_location(first_time, id, longitude_in, latitude_in, time):\n+    with con:\n+        if first_time:\n+            cur.execute(\"\"\"INSERT INTO tracking VALUES (?, ?, ?, ?)\"\"\", (id, longitude_in, latitude_in, time))\n+        else:\n+            cur.execute(\"\"\"UPDATE tracking\n+                           SET longitude=?, latitude=?\n+                           WHERE UUID=?;\"\"\", (longitude_in, latitude_in, id))\n+        con.commit()\n+\n+@app.route(\"/api/location\")\n+def get_location():\n+    cur.execute(\"\"\"SELECT * FROM tracking\"\"\")\n+    result = {\"result\": cur.fetchall()}\n+    return jsonify(result)\n+\n+\n+@app.route('/after_login', methods=['GET'])\n+def after_login():\n+    net_id = session.get(app.config['CAS_USERNAME_SESSION_KEY'], None)\n+    return redirect('/api/numbers')\n+\n+\n+@app.route(\"/api/del_location\")","path":"backend/wellbeing.py","position":68,"original_position":68,"commit_id":"31d38cf7e638ca5a4c591d92d559fd24a4bdfb4c","original_commit_id":"31d38cf7e638ca5a4c591d92d559fd24a4bdfb4c","user":{"login":"phrayezzen","id":4955986,"avatar_url":"https://avatars.githubusercontent.com/u/4955986?v=3","gravatar_id":"","url":"https://api.github.com/users/phrayezzen","html_url":"https://github.com/phrayezzen","followers_url":"https://api.github.com/users/phrayezzen/followers","following_url":"https://api.github.com/users/phrayezzen/following{/other_user}","gists_url":"https://api.github.com/users/phrayezzen/gists{/gist_id}","starred_url":"https://api.github.com/users/phrayezzen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phrayezzen/subscriptions","organizations_url":"https://api.github.com/users/phrayezzen/orgs","repos_url":"https://api.github.com/users/phrayezzen/repos","events_url":"https://api.github.com/users/phrayezzen/events{/privacy}","received_events_url":"https://api.github.com/users/phrayezzen/received_events","type":"User","site_admin":false},"body":"merge this line with /api.location, method=[\"DELETE\"]\r\n\r\nplease see bento.io for RESTful APIs\r\nbasically, all endpoints that affect the same object (in this case location) should be combined into one endpoint","created_at":"2015-03-01T00:55:07Z","updated_at":"2015-03-01T00:55:07Z","html_url":"https://github.com/rice-apps/wellbeing-app/pull/1#discussion_r25562954","pull_request_url":"https://api.github.com/repos/rice-apps/wellbeing-app/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/rice-apps/wellbeing-app/pulls/comments/25562954"},"html":{"href":"https://github.com/rice-apps/wellbeing-app/pull/1#discussion_r25562954"},"pull_request":{"href":"https://api.github.com/repos/rice-apps/wellbeing-app/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/rice-apps/wellbeing-app/pulls/1","id":22985930,"html_url":"https://github.com/rice-apps/wellbeing-app/pull/1","diff_url":"https://github.com/rice-apps/wellbeing-app/pull/1.diff","patch_url":"https://github.com/rice-apps/wellbeing-app/pull/1.patch","issue_url":"https://api.github.com/repos/rice-apps/wellbeing-app/issues/1","number":1,"state":"open","locked":false,"title":"Numbers","user":{"login":"yilinleodu","id":7658093,"avatar_url":"https://avatars.githubusercontent.com/u/7658093?v=3","gravatar_id":"","url":"https://api.github.com/users/yilinleodu","html_url":"https://github.com/yilinleodu","followers_url":"https://api.github.com/users/yilinleodu/followers","following_url":"https://api.github.com/users/yilinleodu/following{/other_user}","gists_url":"https://api.github.com/users/yilinleodu/gists{/gist_id}","starred_url":"https://api.github.com/users/yilinleodu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yilinleodu/subscriptions","organizations_url":"https://api.github.com/users/yilinleodu/orgs","repos_url":"https://api.github.com/users/yilinleodu/repos","events_url":"https://api.github.com/users/yilinleodu/events{/privacy}","received_events_url":"https://api.github.com/users/yilinleodu/received_events","type":"User","site_admin":false},"body":"","created_at":"2014-10-19T21:23:05Z","updated_at":"2015-03-01T00:55:07Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7dc68629137e0290c5942f23c0bec7a45c383cf6","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/rice-apps/wellbeing-app/pulls/1/commits","review_comments_url":"https://api.github.com/repos/rice-apps/wellbeing-app/pulls/1/comments","review_comment_url":"https://api.github.com/repos/rice-apps/wellbeing-app/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rice-apps/wellbeing-app/issues/1/comments","statuses_url":"https://api.github.com/repos/rice-apps/wellbeing-app/statuses/31d38cf7e638ca5a4c591d92d559fd24a4bdfb4c","head":{"label":"rice-apps:numbers","ref":"numbers","sha":"31d38cf7e638ca5a4c591d92d559fd24a4bdfb4c","user":{"login":"rice-apps","id":5874920,"avatar_url":"https://avatars.githubusercontent.com/u/5874920?v=3","gravatar_id":"","url":"https://api.github.com/users/rice-apps","html_url":"https://github.com/rice-apps","followers_url":"https://api.github.com/users/rice-apps/followers","following_url":"https://api.github.com/users/rice-apps/following{/other_user}","gists_url":"https://api.github.com/users/rice-apps/gists{/gist_id}","starred_url":"https://api.github.com/users/rice-apps/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rice-apps/subscriptions","organizations_url":"https://api.github.com/users/rice-apps/orgs","repos_url":"https://api.github.com/users/rice-apps/repos","events_url":"https://api.github.com/users/rice-apps/events{/privacy}","received_events_url":"https://api.github.com/users/rice-apps/received_events","type":"Organization","site_admin":false},"repo":{"id":24271091,"name":"wellbeing-app","full_name":"rice-apps/wellbeing-app","owner":{"login":"rice-apps","id":5874920,"avatar_url":"https://avatars.githubusercontent.com/u/5874920?v=3","gravatar_id":"","url":"https://api.github.com/users/rice-apps","html_url":"https://github.com/rice-apps","followers_url":"https://api.github.com/users/rice-apps/followers","following_url":"https://api.github.com/users/rice-apps/following{/other_user}","gists_url":"https://api.github.com/users/rice-apps/gists{/gist_id}","starred_url":"https://api.github.com/users/rice-apps/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rice-apps/subscriptions","organizations_url":"https://api.github.com/users/rice-apps/orgs","repos_url":"https://api.github.com/users/rice-apps/repos","events_url":"https://api.github.com/users/rice-apps/events{/privacy}","received_events_url":"https://api.github.com/users/rice-apps/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/rice-apps/wellbeing-app","description":"","fork":false,"url":"https://api.github.com/repos/rice-apps/wellbeing-app","forks_url":"https://api.github.com/repos/rice-apps/wellbeing-app/forks","keys_url":"https://api.github.com/repos/rice-apps/wellbeing-app/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rice-apps/wellbeing-app/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rice-apps/wellbeing-app/teams","hooks_url":"https://api.github.com/repos/rice-apps/wellbeing-app/hooks","issue_events_url":"https://api.github.com/repos/rice-apps/wellbeing-app/issues/events{/number}","events_url":"https://api.github.com/repos/rice-apps/wellbeing-app/events","assignees_url":"https://api.github.com/repos/rice-apps/wellbeing-app/assignees{/user}","branches_url":"https://api.github.com/repos/rice-apps/wellbeing-app/branches{/branch}","tags_url":"https://api.github.com/repos/rice-apps/wellbeing-app/tags","blobs_url":"https://api.github.com/repos/rice-apps/wellbeing-app/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rice-apps/wellbeing-app/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rice-apps/wellbeing-app/git/refs{/sha}","trees_url":"https://api.github.com/repos/rice-apps/wellbeing-app/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rice-apps/wellbeing-app/statuses/{sha}","languages_url":"https://api.github.com/repos/rice-apps/wellbeing-app/languages","stargazers_url":"https://api.github.com/repos/rice-apps/wellbeing-app/stargazers","contributors_url":"https://api.github.com/repos/rice-apps/wellbeing-app/contributors","subscribers_url":"https://api.github.com/repos/rice-apps/wellbeing-app/subscribers","subscription_url":"https://api.github.com/repos/rice-apps/wellbeing-app/subscription","commits_url":"https://api.github.com/repos/rice-apps/wellbeing-app/commits{/sha}","git_commits_url":"https://api.github.com/repos/rice-apps/wellbeing-app/git/commits{/sha}","comments_url":"https://api.github.com/repos/rice-apps/wellbeing-app/comments{/number}","issue_comment_url":"https://api.github.com/repos/rice-apps/wellbeing-app/issues/comments{/number}","contents_url":"https://api.github.com/repos/rice-apps/wellbeing-app/contents/{+path}","compare_url":"https://api.github.com/repos/rice-apps/wellbeing-app/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rice-apps/wellbeing-app/merges","archive_url":"https://api.github.com/repos/rice-apps/wellbeing-app/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rice-apps/wellbeing-app/downloads","issues_url":"https://api.github.com/repos/rice-apps/wellbeing-app/issues{/number}","pulls_url":"https://api.github.com/repos/rice-apps/wellbeing-app/pulls{/number}","milestones_url":"https://api.github.com/repos/rice-apps/wellbeing-app/milestones{/number}","notifications_url":"https://api.github.com/repos/rice-apps/wellbeing-app/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rice-apps/wellbeing-app/labels{/name}","releases_url":"https://api.github.com/repos/rice-apps/wellbeing-app/releases{/id}","created_at":"2014-09-20T18:37:35Z","updated_at":"2015-02-23T02:43:14Z","pushed_at":"2015-02-23T02:43:14Z","git_url":"git://github.com/rice-apps/wellbeing-app.git","ssh_url":"git@github.com:rice-apps/wellbeing-app.git","clone_url":"https://github.com/rice-apps/wellbeing-app.git","svn_url":"https://github.com/rice-apps/wellbeing-app","homepage":null,"size":3292,"stargazers_count":0,"watchers_count":0,"language":"Objective-C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"rice-apps:master","ref":"master","sha":"5d443a0c20fffa7fc7314abd18d38cd34bc8b0fc","user":{"login":"rice-apps","id":5874920,"avatar_url":"https://avatars.githubusercontent.com/u/5874920?v=3","gravatar_id":"","url":"https://api.github.com/users/rice-apps","html_url":"https://github.com/rice-apps","followers_url":"https://api.github.com/users/rice-apps/followers","following_url":"https://api.github.com/users/rice-apps/following{/other_user}","gists_url":"https://api.github.com/users/rice-apps/gists{/gist_id}","starred_url":"https://api.github.com/users/rice-apps/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rice-apps/subscriptions","organizations_url":"https://api.github.com/users/rice-apps/orgs","repos_url":"https://api.github.com/users/rice-apps/repos","events_url":"https://api.github.com/users/rice-apps/events{/privacy}","received_events_url":"https://api.github.com/users/rice-apps/received_events","type":"Organization","site_admin":false},"repo":{"id":24271091,"name":"wellbeing-app","full_name":"rice-apps/wellbeing-app","owner":{"login":"rice-apps","id":5874920,"avatar_url":"https://avatars.githubusercontent.com/u/5874920?v=3","gravatar_id":"","url":"https://api.github.com/users/rice-apps","html_url":"https://github.com/rice-apps","followers_url":"https://api.github.com/users/rice-apps/followers","following_url":"https://api.github.com/users/rice-apps/following{/other_user}","gists_url":"https://api.github.com/users/rice-apps/gists{/gist_id}","starred_url":"https://api.github.com/users/rice-apps/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rice-apps/subscriptions","organizations_url":"https://api.github.com/users/rice-apps/orgs","repos_url":"https://api.github.com/users/rice-apps/repos","events_url":"https://api.github.com/users/rice-apps/events{/privacy}","received_events_url":"https://api.github.com/users/rice-apps/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/rice-apps/wellbeing-app","description":"","fork":false,"url":"https://api.github.com/repos/rice-apps/wellbeing-app","forks_url":"https://api.github.com/repos/rice-apps/wellbeing-app/forks","keys_url":"https://api.github.com/repos/rice-apps/wellbeing-app/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rice-apps/wellbeing-app/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rice-apps/wellbeing-app/teams","hooks_url":"https://api.github.com/repos/rice-apps/wellbeing-app/hooks","issue_events_url":"https://api.github.com/repos/rice-apps/wellbeing-app/issues/events{/number}","events_url":"https://api.github.com/repos/rice-apps/wellbeing-app/events","assignees_url":"https://api.github.com/repos/rice-apps/wellbeing-app/assignees{/user}","branches_url":"https://api.github.com/repos/rice-apps/wellbeing-app/branches{/branch}","tags_url":"https://api.github.com/repos/rice-apps/wellbeing-app/tags","blobs_url":"https://api.github.com/repos/rice-apps/wellbeing-app/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rice-apps/wellbeing-app/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rice-apps/wellbeing-app/git/refs{/sha}","trees_url":"https://api.github.com/repos/rice-apps/wellbeing-app/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rice-apps/wellbeing-app/statuses/{sha}","languages_url":"https://api.github.com/repos/rice-apps/wellbeing-app/languages","stargazers_url":"https://api.github.com/repos/rice-apps/wellbeing-app/stargazers","contributors_url":"https://api.github.com/repos/rice-apps/wellbeing-app/contributors","subscribers_url":"https://api.github.com/repos/rice-apps/wellbeing-app/subscribers","subscription_url":"https://api.github.com/repos/rice-apps/wellbeing-app/subscription","commits_url":"https://api.github.com/repos/rice-apps/wellbeing-app/commits{/sha}","git_commits_url":"https://api.github.com/repos/rice-apps/wellbeing-app/git/commits{/sha}","comments_url":"https://api.github.com/repos/rice-apps/wellbeing-app/comments{/number}","issue_comment_url":"https://api.github.com/repos/rice-apps/wellbeing-app/issues/comments{/number}","contents_url":"https://api.github.com/repos/rice-apps/wellbeing-app/contents/{+path}","compare_url":"https://api.github.com/repos/rice-apps/wellbeing-app/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rice-apps/wellbeing-app/merges","archive_url":"https://api.github.com/repos/rice-apps/wellbeing-app/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rice-apps/wellbeing-app/downloads","issues_url":"https://api.github.com/repos/rice-apps/wellbeing-app/issues{/number}","pulls_url":"https://api.github.com/repos/rice-apps/wellbeing-app/pulls{/number}","milestones_url":"https://api.github.com/repos/rice-apps/wellbeing-app/milestones{/number}","notifications_url":"https://api.github.com/repos/rice-apps/wellbeing-app/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rice-apps/wellbeing-app/labels{/name}","releases_url":"https://api.github.com/repos/rice-apps/wellbeing-app/releases{/id}","created_at":"2014-09-20T18:37:35Z","updated_at":"2015-02-23T02:43:14Z","pushed_at":"2015-02-23T02:43:14Z","git_url":"git://github.com/rice-apps/wellbeing-app.git","ssh_url":"git@github.com:rice-apps/wellbeing-app.git","clone_url":"https://github.com/rice-apps/wellbeing-app.git","svn_url":"https://github.com/rice-apps/wellbeing-app","homepage":null,"size":3292,"stargazers_count":0,"watchers_count":0,"language":"Objective-C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rice-apps/wellbeing-app/pulls/1"},"html":{"href":"https://github.com/rice-apps/wellbeing-app/pull/1"},"issue":{"href":"https://api.github.com/repos/rice-apps/wellbeing-app/issues/1"},"comments":{"href":"https://api.github.com/repos/rice-apps/wellbeing-app/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/rice-apps/wellbeing-app/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/rice-apps/wellbeing-app/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rice-apps/wellbeing-app/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/rice-apps/wellbeing-app/statuses/31d38cf7e638ca5a4c591d92d559fd24a4bdfb4c"}}}}