{"action":"created","comment":{"url":"https://api.github.com/repos/thecourseforum/theCourseForum/pulls/comments/35505926","id":35505926,"diff_hunk":"@@ -0,0 +1,122 @@\n+class TextbookTransactionsController < ApplicationController\n+\n+  def index\n+    @textbook_transactions = TextbookTransaction.active.map do |tt|\n+      {\n+        :id => tt.id,\n+        :price => \"$\" + tt.price.to_s,\n+        :courses => tt.book.sections.map(&:course).uniq.map(&:mnemonic_number).join(\", \"),\n+        :title => tt.book.title,\n+        :book_id => tt.book_id,\n+        :author => tt.book.author,\n+        :condition => tt.condition,\n+        :notes => tt.notes,\n+        :end_date => (tt.created_at + 3.days).localtime.strftime(\"%b %d, %I:%M %p\")\n+      }\n+    end\n+  end\n+\n+  def books\n+    @books = Book.order(\"RAND()\").map do |book|\n+      {\n+        :image => (book.small_image_link ? book.small_image_link : \"/assets/icons/no_book.png\"),\n+        :title => book.title,\n+        :id => book.id\n+      }\n+    end\n+  end\n+\n+  def get_book_titles\n+    query = params[:query]\n+\n+    results = Book.order(\"RAND()\").map do |book|\n+      {\n+        :id => book.id,\n+        :title => book.title,\n+        :image => (book.small_image_link ? book.small_image_link : \"/assets/icons/no_book.png\")\n+      }\n+    end\n+\n+    render :json => [results]\n+  end\n+\n+  def claim\n+    puts params\n+    cell = params[:cellphone].strip\n+    current_user.update(:cellphone => cell)\n+    transaction = TextbookTransaction.active.find(params[:claim_id])","path":"app/controllers/textbook_transactions_controller.rb","position":47,"original_position":47,"commit_id":"9fb703d28fa46823034510b11abfd0822adfbd7f","original_commit_id":"9fb703d28fa46823034510b11abfd0822adfbd7f","user":{"login":"aw3as","id":7268640,"avatar_url":"https://avatars.githubusercontent.com/u/7268640?v=3","gravatar_id":"","url":"https://api.github.com/users/aw3as","html_url":"https://github.com/aw3as","followers_url":"https://api.github.com/users/aw3as/followers","following_url":"https://api.github.com/users/aw3as/following{/other_user}","gists_url":"https://api.github.com/users/aw3as/gists{/gist_id}","starred_url":"https://api.github.com/users/aw3as/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aw3as/subscriptions","organizations_url":"https://api.github.com/users/aw3as/orgs","repos_url":"https://api.github.com/users/aw3as/repos","events_url":"https://api.github.com/users/aw3as/events{/privacy}","received_events_url":"https://api.github.com/users/aw3as/received_events","type":"User","site_admin":false},"body":"why search through active transactions? incur additional sql queries","created_at":"2015-07-27T05:08:20Z","updated_at":"2015-07-27T05:08:20Z","html_url":"https://github.com/thecourseforum/theCourseForum/pull/139#discussion_r35505926","pull_request_url":"https://api.github.com/repos/thecourseforum/theCourseForum/pulls/139","_links":{"self":{"href":"https://api.github.com/repos/thecourseforum/theCourseForum/pulls/comments/35505926"},"html":{"href":"https://github.com/thecourseforum/theCourseForum/pull/139#discussion_r35505926"},"pull_request":{"href":"https://api.github.com/repos/thecourseforum/theCourseForum/pulls/139"}}},"pull_request":{"url":"https://api.github.com/repos/thecourseforum/theCourseForum/pulls/139","id":40870771,"html_url":"https://github.com/thecourseforum/theCourseForum/pull/139","diff_url":"https://github.com/thecourseforum/theCourseForum/pull/139.diff","patch_url":"https://github.com/thecourseforum/theCourseForum/pull/139.patch","issue_url":"https://api.github.com/repos/thecourseforum/theCourseForum/issues/139","number":139,"state":"open","locked":false,"title":"Textbook listing","user":{"login":"emumoo","id":6572030,"avatar_url":"https://avatars.githubusercontent.com/u/6572030?v=3","gravatar_id":"","url":"https://api.github.com/users/emumoo","html_url":"https://github.com/emumoo","followers_url":"https://api.github.com/users/emumoo/followers","following_url":"https://api.github.com/users/emumoo/following{/other_user}","gists_url":"https://api.github.com/users/emumoo/gists{/gist_id}","starred_url":"https://api.github.com/users/emumoo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/emumoo/subscriptions","organizations_url":"https://api.github.com/users/emumoo/orgs","repos_url":"https://api.github.com/users/emumoo/repos","events_url":"https://api.github.com/users/emumoo/events{/privacy}","received_events_url":"https://api.github.com/users/emumoo/received_events","type":"User","site_admin":false},"body":"@aw3as yo","created_at":"2015-07-27T05:05:35Z","updated_at":"2015-07-27T05:08:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":"000c3a6277bdb8eb8efcadcfa5d696f522ca18fc","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/thecourseforum/theCourseForum/pulls/139/commits","review_comments_url":"https://api.github.com/repos/thecourseforum/theCourseForum/pulls/139/comments","review_comment_url":"https://api.github.com/repos/thecourseforum/theCourseForum/pulls/comments{/number}","comments_url":"https://api.github.com/repos/thecourseforum/theCourseForum/issues/139/comments","statuses_url":"https://api.github.com/repos/thecourseforum/theCourseForum/statuses/9fb703d28fa46823034510b11abfd0822adfbd7f","head":{"label":"thecourseforum:textbook_listing","ref":"textbook_listing","sha":"9fb703d28fa46823034510b11abfd0822adfbd7f","user":{"login":"thecourseforum","id":1744258,"avatar_url":"https://avatars.githubusercontent.com/u/1744258?v=3","gravatar_id":"","url":"https://api.github.com/users/thecourseforum","html_url":"https://github.com/thecourseforum","followers_url":"https://api.github.com/users/thecourseforum/followers","following_url":"https://api.github.com/users/thecourseforum/following{/other_user}","gists_url":"https://api.github.com/users/thecourseforum/gists{/gist_id}","starred_url":"https://api.github.com/users/thecourseforum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thecourseforum/subscriptions","organizations_url":"https://api.github.com/users/thecourseforum/orgs","repos_url":"https://api.github.com/users/thecourseforum/repos","events_url":"https://api.github.com/users/thecourseforum/events{/privacy}","received_events_url":"https://api.github.com/users/thecourseforum/received_events","type":"Organization","site_admin":false},"repo":{"id":4361779,"name":"theCourseForum","full_name":"thecourseforum/theCourseForum","owner":{"login":"thecourseforum","id":1744258,"avatar_url":"https://avatars.githubusercontent.com/u/1744258?v=3","gravatar_id":"","url":"https://api.github.com/users/thecourseforum","html_url":"https://github.com/thecourseforum","followers_url":"https://api.github.com/users/thecourseforum/followers","following_url":"https://api.github.com/users/thecourseforum/following{/other_user}","gists_url":"https://api.github.com/users/thecourseforum/gists{/gist_id}","starred_url":"https://api.github.com/users/thecourseforum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thecourseforum/subscriptions","organizations_url":"https://api.github.com/users/thecourseforum/orgs","repos_url":"https://api.github.com/users/thecourseforum/repos","events_url":"https://api.github.com/users/thecourseforum/events{/privacy}","received_events_url":"https://api.github.com/users/thecourseforum/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/thecourseforum/theCourseForum","description":"theCourseForum project","fork":false,"url":"https://api.github.com/repos/thecourseforum/theCourseForum","forks_url":"https://api.github.com/repos/thecourseforum/theCourseForum/forks","keys_url":"https://api.github.com/repos/thecourseforum/theCourseForum/keys{/key_id}","collaborators_url":"https://api.github.com/repos/thecourseforum/theCourseForum/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/thecourseforum/theCourseForum/teams","hooks_url":"https://api.github.com/repos/thecourseforum/theCourseForum/hooks","issue_events_url":"https://api.github.com/repos/thecourseforum/theCourseForum/issues/events{/number}","events_url":"https://api.github.com/repos/thecourseforum/theCourseForum/events","assignees_url":"https://api.github.com/repos/thecourseforum/theCourseForum/assignees{/user}","branches_url":"https://api.github.com/repos/thecourseforum/theCourseForum/branches{/branch}","tags_url":"https://api.github.com/repos/thecourseforum/theCourseForum/tags","blobs_url":"https://api.github.com/repos/thecourseforum/theCourseForum/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/thecourseforum/theCourseForum/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/thecourseforum/theCourseForum/git/refs{/sha}","trees_url":"https://api.github.com/repos/thecourseforum/theCourseForum/git/trees{/sha}","statuses_url":"https://api.github.com/repos/thecourseforum/theCourseForum/statuses/{sha}","languages_url":"https://api.github.com/repos/thecourseforum/theCourseForum/languages","stargazers_url":"https://api.github.com/repos/thecourseforum/theCourseForum/stargazers","contributors_url":"https://api.github.com/repos/thecourseforum/theCourseForum/contributors","subscribers_url":"https://api.github.com/repos/thecourseforum/theCourseForum/subscribers","subscription_url":"https://api.github.com/repos/thecourseforum/theCourseForum/subscription","commits_url":"https://api.github.com/repos/thecourseforum/theCourseForum/commits{/sha}","git_commits_url":"https://api.github.com/repos/thecourseforum/theCourseForum/git/commits{/sha}","comments_url":"https://api.github.com/repos/thecourseforum/theCourseForum/comments{/number}","issue_comment_url":"https://api.github.com/repos/thecourseforum/theCourseForum/issues/comments{/number}","contents_url":"https://api.github.com/repos/thecourseforum/theCourseForum/contents/{+path}","compare_url":"https://api.github.com/repos/thecourseforum/theCourseForum/compare/{base}...{head}","merges_url":"https://api.github.com/repos/thecourseforum/theCourseForum/merges","archive_url":"https://api.github.com/repos/thecourseforum/theCourseForum/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/thecourseforum/theCourseForum/downloads","issues_url":"https://api.github.com/repos/thecourseforum/theCourseForum/issues{/number}","pulls_url":"https://api.github.com/repos/thecourseforum/theCourseForum/pulls{/number}","milestones_url":"https://api.github.com/repos/thecourseforum/theCourseForum/milestones{/number}","notifications_url":"https://api.github.com/repos/thecourseforum/theCourseForum/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/thecourseforum/theCourseForum/labels{/name}","releases_url":"https://api.github.com/repos/thecourseforum/theCourseForum/releases{/id}","created_at":"2012-05-17T18:53:38Z","updated_at":"2015-07-17T15:39:44Z","pushed_at":"2015-07-27T05:05:35Z","git_url":"git://github.com/thecourseforum/theCourseForum.git","ssh_url":"git@github.com:thecourseforum/theCourseForum.git","clone_url":"https://github.com/thecourseforum/theCourseForum.git","svn_url":"https://github.com/thecourseforum/theCourseForum","homepage":"www.thecourseforum.com","size":31153,"stargazers_count":11,"watchers_count":11,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":12,"mirror_url":null,"open_issues_count":45,"forks":12,"open_issues":45,"watchers":11,"default_branch":"master"}},"base":{"label":"thecourseforum:class-show-flex","ref":"class-show-flex","sha":"49f73353f54796a266110a2ca99a4b27531f7bf1","user":{"login":"thecourseforum","id":1744258,"avatar_url":"https://avatars.githubusercontent.com/u/1744258?v=3","gravatar_id":"","url":"https://api.github.com/users/thecourseforum","html_url":"https://github.com/thecourseforum","followers_url":"https://api.github.com/users/thecourseforum/followers","following_url":"https://api.github.com/users/thecourseforum/following{/other_user}","gists_url":"https://api.github.com/users/thecourseforum/gists{/gist_id}","starred_url":"https://api.github.com/users/thecourseforum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thecourseforum/subscriptions","organizations_url":"https://api.github.com/users/thecourseforum/orgs","repos_url":"https://api.github.com/users/thecourseforum/repos","events_url":"https://api.github.com/users/thecourseforum/events{/privacy}","received_events_url":"https://api.github.com/users/thecourseforum/received_events","type":"Organization","site_admin":false},"repo":{"id":4361779,"name":"theCourseForum","full_name":"thecourseforum/theCourseForum","owner":{"login":"thecourseforum","id":1744258,"avatar_url":"https://avatars.githubusercontent.com/u/1744258?v=3","gravatar_id":"","url":"https://api.github.com/users/thecourseforum","html_url":"https://github.com/thecourseforum","followers_url":"https://api.github.com/users/thecourseforum/followers","following_url":"https://api.github.com/users/thecourseforum/following{/other_user}","gists_url":"https://api.github.com/users/thecourseforum/gists{/gist_id}","starred_url":"https://api.github.com/users/thecourseforum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thecourseforum/subscriptions","organizations_url":"https://api.github.com/users/thecourseforum/orgs","repos_url":"https://api.github.com/users/thecourseforum/repos","events_url":"https://api.github.com/users/thecourseforum/events{/privacy}","received_events_url":"https://api.github.com/users/thecourseforum/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/thecourseforum/theCourseForum","description":"theCourseForum project","fork":false,"url":"https://api.github.com/repos/thecourseforum/theCourseForum","forks_url":"https://api.github.com/repos/thecourseforum/theCourseForum/forks","keys_url":"https://api.github.com/repos/thecourseforum/theCourseForum/keys{/key_id}","collaborators_url":"https://api.github.com/repos/thecourseforum/theCourseForum/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/thecourseforum/theCourseForum/teams","hooks_url":"https://api.github.com/repos/thecourseforum/theCourseForum/hooks","issue_events_url":"https://api.github.com/repos/thecourseforum/theCourseForum/issues/events{/number}","events_url":"https://api.github.com/repos/thecourseforum/theCourseForum/events","assignees_url":"https://api.github.com/repos/thecourseforum/theCourseForum/assignees{/user}","branches_url":"https://api.github.com/repos/thecourseforum/theCourseForum/branches{/branch}","tags_url":"https://api.github.com/repos/thecourseforum/theCourseForum/tags","blobs_url":"https://api.github.com/repos/thecourseforum/theCourseForum/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/thecourseforum/theCourseForum/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/thecourseforum/theCourseForum/git/refs{/sha}","trees_url":"https://api.github.com/repos/thecourseforum/theCourseForum/git/trees{/sha}","statuses_url":"https://api.github.com/repos/thecourseforum/theCourseForum/statuses/{sha}","languages_url":"https://api.github.com/repos/thecourseforum/theCourseForum/languages","stargazers_url":"https://api.github.com/repos/thecourseforum/theCourseForum/stargazers","contributors_url":"https://api.github.com/repos/thecourseforum/theCourseForum/contributors","subscribers_url":"https://api.github.com/repos/thecourseforum/theCourseForum/subscribers","subscription_url":"https://api.github.com/repos/thecourseforum/theCourseForum/subscription","commits_url":"https://api.github.com/repos/thecourseforum/theCourseForum/commits{/sha}","git_commits_url":"https://api.github.com/repos/thecourseforum/theCourseForum/git/commits{/sha}","comments_url":"https://api.github.com/repos/thecourseforum/theCourseForum/comments{/number}","issue_comment_url":"https://api.github.com/repos/thecourseforum/theCourseForum/issues/comments{/number}","contents_url":"https://api.github.com/repos/thecourseforum/theCourseForum/contents/{+path}","compare_url":"https://api.github.com/repos/thecourseforum/theCourseForum/compare/{base}...{head}","merges_url":"https://api.github.com/repos/thecourseforum/theCourseForum/merges","archive_url":"https://api.github.com/repos/thecourseforum/theCourseForum/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/thecourseforum/theCourseForum/downloads","issues_url":"https://api.github.com/repos/thecourseforum/theCourseForum/issues{/number}","pulls_url":"https://api.github.com/repos/thecourseforum/theCourseForum/pulls{/number}","milestones_url":"https://api.github.com/repos/thecourseforum/theCourseForum/milestones{/number}","notifications_url":"https://api.github.com/repos/thecourseforum/theCourseForum/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/thecourseforum/theCourseForum/labels{/name}","releases_url":"https://api.github.com/repos/thecourseforum/theCourseForum/releases{/id}","created_at":"2012-05-17T18:53:38Z","updated_at":"2015-07-17T15:39:44Z","pushed_at":"2015-07-27T05:05:35Z","git_url":"git://github.com/thecourseforum/theCourseForum.git","ssh_url":"git@github.com:thecourseforum/theCourseForum.git","clone_url":"https://github.com/thecourseforum/theCourseForum.git","svn_url":"https://github.com/thecourseforum/theCourseForum","homepage":"www.thecourseforum.com","size":31153,"stargazers_count":11,"watchers_count":11,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":12,"mirror_url":null,"open_issues_count":45,"forks":12,"open_issues":45,"watchers":11,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/thecourseforum/theCourseForum/pulls/139"},"html":{"href":"https://github.com/thecourseforum/theCourseForum/pull/139"},"issue":{"href":"https://api.github.com/repos/thecourseforum/theCourseForum/issues/139"},"comments":{"href":"https://api.github.com/repos/thecourseforum/theCourseForum/issues/139/comments"},"review_comments":{"href":"https://api.github.com/repos/thecourseforum/theCourseForum/pulls/139/comments"},"review_comment":{"href":"https://api.github.com/repos/thecourseforum/theCourseForum/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/thecourseforum/theCourseForum/pulls/139/commits"},"statuses":{"href":"https://api.github.com/repos/thecourseforum/theCourseForum/statuses/9fb703d28fa46823034510b11abfd0822adfbd7f"}}}}