{"action":"created","comment":{"url":"https://api.github.com/repos/code-dot-org/code-dot-org/pulls/comments/26544303","id":26544303,"diff_hunk":"@@ -44,4 +44,32 @@ def lesson_plan_pdf_url\n   def lesson_plan_base_url\n     CDO.code_org_url \"/curriculum/#{script.name}/#{position}\"\n   end\n+\n+  def summarize\n+    stage_data = {\n+        script_id: script.id,\n+        script_name: script.name,\n+        script_stages: script.stages.to_a.count,\n+        id: id,\n+        position: position,\n+        name: localized_name,\n+        title: localized_title\n+    }\n+\n+    if script.has_lesson_plan?\n+      stage_data[:lesson_plan_html_url] = lesson_plan_html_url\n+      stage_data[:lesson_plan_pdf_url] = lesson_plan_pdf_url\n+    end\n+\n+    if script.hoc?\n+      stage_data[:finishLink] = script.hoc_finish_url\n+      stage_data[:finishText] = I18n.t('nav.header.finished_hoc')\n+    end\n+\n+    levels = script.script_levels.to_a.select{|sl| sl.stage_id == id}","path":"dashboard/app/models/stage.rb","position":null,"original_position":26,"commit_id":"aa66afabb1e5c4f71ec3c3e51c362ea8d4c7a855","original_commit_id":"112e77d2aaba19a652a2d3e4ac1a4cda47b37aec","user":{"login":"SteveEisner","id":2086039,"avatar_url":"https://avatars.githubusercontent.com/u/2086039?v=3","gravatar_id":"","url":"https://api.github.com/users/SteveEisner","html_url":"https://github.com/SteveEisner","followers_url":"https://api.github.com/users/SteveEisner/followers","following_url":"https://api.github.com/users/SteveEisner/following{/other_user}","gists_url":"https://api.github.com/users/SteveEisner/gists{/gist_id}","starred_url":"https://api.github.com/users/SteveEisner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SteveEisner/subscriptions","organizations_url":"https://api.github.com/users/SteveEisner/orgs","repos_url":"https://api.github.com/users/SteveEisner/repos","events_url":"https://api.github.com/users/SteveEisner/events{/privacy}","received_events_url":"https://api.github.com/users/SteveEisner/received_events","type":"User","site_admin":false},"body":"If I remember this correctly (it's been a while since I wrote that) it was just code that I pulled in from elsewhere.  That means that either:\r\na) I never checked to see that stage.script_levels was correct in all cases, or\r\nb) I found that it wasn't -- for instance maybe with scripts that had game/chapter definitions vs stage/level etc.\r\nI don't think I did it for pure caching reasons.","created_at":"2015-03-17T01:56:48Z","updated_at":"2015-03-17T01:56:48Z","html_url":"https://github.com/code-dot-org/code-dot-org/pull/1536#discussion_r26544303","pull_request_url":"https://api.github.com/repos/code-dot-org/code-dot-org/pulls/1536","_links":{"self":{"href":"https://api.github.com/repos/code-dot-org/code-dot-org/pulls/comments/26544303"},"html":{"href":"https://github.com/code-dot-org/code-dot-org/pull/1536#discussion_r26544303"},"pull_request":{"href":"https://api.github.com/repos/code-dot-org/code-dot-org/pulls/1536"}}},"pull_request":{"url":"https://api.github.com/repos/code-dot-org/code-dot-org/pulls/1536","id":30805581,"html_url":"https://github.com/code-dot-org/code-dot-org/pull/1536","diff_url":"https://github.com/code-dot-org/code-dot-org/pull/1536.diff","patch_url":"https://github.com/code-dot-org/code-dot-org/pull/1536.patch","issue_url":"https://api.github.com/repos/code-dot-org/code-dot-org/issues/1536","number":1536,"state":"open","locked":false,"title":"@SteveEisner's Dashboard API Changes","user":{"login":"joshlory","id":413693,"avatar_url":"https://avatars.githubusercontent.com/u/413693?v=3","gravatar_id":"","url":"https://api.github.com/users/joshlory","html_url":"https://github.com/joshlory","followers_url":"https://api.github.com/users/joshlory/followers","following_url":"https://api.github.com/users/joshlory/following{/other_user}","gists_url":"https://api.github.com/users/joshlory/gists{/gist_id}","starred_url":"https://api.github.com/users/joshlory/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joshlory/subscriptions","organizations_url":"https://api.github.com/users/joshlory/orgs","repos_url":"https://api.github.com/users/joshlory/repos","events_url":"https://api.github.com/users/joshlory/events{/privacy}","received_events_url":"https://api.github.com/users/joshlory/received_events","type":"User","site_admin":false},"body":"Abandoning #1532 and creating a new PR to `staging`.\r\n\r\nThis PR is the first step in a series of changes to safely merge branch:react_header with high confidence that we won't break the site for any of our users.  It exposes `.summarize` methods for `Script`, `Stage` and `ScriptLevel` which give JSON serializations of those instances.\r\n\r\nWe've removed `header_progress` in favor of two separate methods: `Stage#summarize` and `UsersHelper#summarize_user_progress`.  The idea is that all non-user-specific JSON will be fully cacheable, and the only data that varies per-user will eventually come from an separate API endpoint.","created_at":"2015-03-09T22:16:08Z","updated_at":"2015-03-17T01:56:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"62b3693cd236620648ba791c7fe436d90c1f7eb7","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/code-dot-org/code-dot-org/pulls/1536/commits","review_comments_url":"https://api.github.com/repos/code-dot-org/code-dot-org/pulls/1536/comments","review_comment_url":"https://api.github.com/repos/code-dot-org/code-dot-org/pulls/comments{/number}","comments_url":"https://api.github.com/repos/code-dot-org/code-dot-org/issues/1536/comments","statuses_url":"https://api.github.com/repos/code-dot-org/code-dot-org/statuses/aa66afabb1e5c4f71ec3c3e51c362ea8d4c7a855","head":{"label":"code-dot-org:api-changes","ref":"api-changes","sha":"aa66afabb1e5c4f71ec3c3e51c362ea8d4c7a855","user":{"login":"code-dot-org","id":5124627,"avatar_url":"https://avatars.githubusercontent.com/u/5124627?v=3","gravatar_id":"","url":"https://api.github.com/users/code-dot-org","html_url":"https://github.com/code-dot-org","followers_url":"https://api.github.com/users/code-dot-org/followers","following_url":"https://api.github.com/users/code-dot-org/following{/other_user}","gists_url":"https://api.github.com/users/code-dot-org/gists{/gist_id}","starred_url":"https://api.github.com/users/code-dot-org/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/code-dot-org/subscriptions","organizations_url":"https://api.github.com/users/code-dot-org/orgs","repos_url":"https://api.github.com/users/code-dot-org/repos","events_url":"https://api.github.com/users/code-dot-org/events{/privacy}","received_events_url":"https://api.github.com/users/code-dot-org/received_events","type":"Organization","site_admin":false},"repo":{"id":24250009,"name":"code-dot-org","full_name":"code-dot-org/code-dot-org","owner":{"login":"code-dot-org","id":5124627,"avatar_url":"https://avatars.githubusercontent.com/u/5124627?v=3","gravatar_id":"","url":"https://api.github.com/users/code-dot-org","html_url":"https://github.com/code-dot-org","followers_url":"https://api.github.com/users/code-dot-org/followers","following_url":"https://api.github.com/users/code-dot-org/following{/other_user}","gists_url":"https://api.github.com/users/code-dot-org/gists{/gist_id}","starred_url":"https://api.github.com/users/code-dot-org/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/code-dot-org/subscriptions","organizations_url":"https://api.github.com/users/code-dot-org/orgs","repos_url":"https://api.github.com/users/code-dot-org/repos","events_url":"https://api.github.com/users/code-dot-org/events{/privacy}","received_events_url":"https://api.github.com/users/code-dot-org/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/code-dot-org/code-dot-org","description":"The code powering code.org and studio.code.org","fork":false,"url":"https://api.github.com/repos/code-dot-org/code-dot-org","forks_url":"https://api.github.com/repos/code-dot-org/code-dot-org/forks","keys_url":"https://api.github.com/repos/code-dot-org/code-dot-org/keys{/key_id}","collaborators_url":"https://api.github.com/repos/code-dot-org/code-dot-org/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/code-dot-org/code-dot-org/teams","hooks_url":"https://api.github.com/repos/code-dot-org/code-dot-org/hooks","issue_events_url":"https://api.github.com/repos/code-dot-org/code-dot-org/issues/events{/number}","events_url":"https://api.github.com/repos/code-dot-org/code-dot-org/events","assignees_url":"https://api.github.com/repos/code-dot-org/code-dot-org/assignees{/user}","branches_url":"https://api.github.com/repos/code-dot-org/code-dot-org/branches{/branch}","tags_url":"https://api.github.com/repos/code-dot-org/code-dot-org/tags","blobs_url":"https://api.github.com/repos/code-dot-org/code-dot-org/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/code-dot-org/code-dot-org/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/code-dot-org/code-dot-org/git/refs{/sha}","trees_url":"https://api.github.com/repos/code-dot-org/code-dot-org/git/trees{/sha}","statuses_url":"https://api.github.com/repos/code-dot-org/code-dot-org/statuses/{sha}","languages_url":"https://api.github.com/repos/code-dot-org/code-dot-org/languages","stargazers_url":"https://api.github.com/repos/code-dot-org/code-dot-org/stargazers","contributors_url":"https://api.github.com/repos/code-dot-org/code-dot-org/contributors","subscribers_url":"https://api.github.com/repos/code-dot-org/code-dot-org/subscribers","subscription_url":"https://api.github.com/repos/code-dot-org/code-dot-org/subscription","commits_url":"https://api.github.com/repos/code-dot-org/code-dot-org/commits{/sha}","git_commits_url":"https://api.github.com/repos/code-dot-org/code-dot-org/git/commits{/sha}","comments_url":"https://api.github.com/repos/code-dot-org/code-dot-org/comments{/number}","issue_comment_url":"https://api.github.com/repos/code-dot-org/code-dot-org/issues/comments{/number}","contents_url":"https://api.github.com/repos/code-dot-org/code-dot-org/contents/{+path}","compare_url":"https://api.github.com/repos/code-dot-org/code-dot-org/compare/{base}...{head}","merges_url":"https://api.github.com/repos/code-dot-org/code-dot-org/merges","archive_url":"https://api.github.com/repos/code-dot-org/code-dot-org/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/code-dot-org/code-dot-org/downloads","issues_url":"https://api.github.com/repos/code-dot-org/code-dot-org/issues{/number}","pulls_url":"https://api.github.com/repos/code-dot-org/code-dot-org/pulls{/number}","milestones_url":"https://api.github.com/repos/code-dot-org/code-dot-org/milestones{/number}","notifications_url":"https://api.github.com/repos/code-dot-org/code-dot-org/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/code-dot-org/code-dot-org/labels{/name}","releases_url":"https://api.github.com/repos/code-dot-org/code-dot-org/releases{/id}","created_at":"2014-09-20T00:46:11Z","updated_at":"2015-03-17T01:00:18Z","pushed_at":"2015-03-17T01:00:18Z","git_url":"git://github.com/code-dot-org/code-dot-org.git","ssh_url":"git@github.com:code-dot-org/code-dot-org.git","clone_url":"https://github.com/code-dot-org/code-dot-org.git","svn_url":"https://github.com/code-dot-org/code-dot-org","homepage":"http://code.org","size":1758297,"stargazers_count":27,"watchers_count":27,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":21,"mirror_url":null,"open_issues_count":25,"forks":21,"open_issues":25,"watchers":27,"default_branch":"staging"}},"base":{"label":"code-dot-org:staging","ref":"staging","sha":"e6a14224405eddf8c06921d6f429401fcc014316","user":{"login":"code-dot-org","id":5124627,"avatar_url":"https://avatars.githubusercontent.com/u/5124627?v=3","gravatar_id":"","url":"https://api.github.com/users/code-dot-org","html_url":"https://github.com/code-dot-org","followers_url":"https://api.github.com/users/code-dot-org/followers","following_url":"https://api.github.com/users/code-dot-org/following{/other_user}","gists_url":"https://api.github.com/users/code-dot-org/gists{/gist_id}","starred_url":"https://api.github.com/users/code-dot-org/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/code-dot-org/subscriptions","organizations_url":"https://api.github.com/users/code-dot-org/orgs","repos_url":"https://api.github.com/users/code-dot-org/repos","events_url":"https://api.github.com/users/code-dot-org/events{/privacy}","received_events_url":"https://api.github.com/users/code-dot-org/received_events","type":"Organization","site_admin":false},"repo":{"id":24250009,"name":"code-dot-org","full_name":"code-dot-org/code-dot-org","owner":{"login":"code-dot-org","id":5124627,"avatar_url":"https://avatars.githubusercontent.com/u/5124627?v=3","gravatar_id":"","url":"https://api.github.com/users/code-dot-org","html_url":"https://github.com/code-dot-org","followers_url":"https://api.github.com/users/code-dot-org/followers","following_url":"https://api.github.com/users/code-dot-org/following{/other_user}","gists_url":"https://api.github.com/users/code-dot-org/gists{/gist_id}","starred_url":"https://api.github.com/users/code-dot-org/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/code-dot-org/subscriptions","organizations_url":"https://api.github.com/users/code-dot-org/orgs","repos_url":"https://api.github.com/users/code-dot-org/repos","events_url":"https://api.github.com/users/code-dot-org/events{/privacy}","received_events_url":"https://api.github.com/users/code-dot-org/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/code-dot-org/code-dot-org","description":"The code powering code.org and studio.code.org","fork":false,"url":"https://api.github.com/repos/code-dot-org/code-dot-org","forks_url":"https://api.github.com/repos/code-dot-org/code-dot-org/forks","keys_url":"https://api.github.com/repos/code-dot-org/code-dot-org/keys{/key_id}","collaborators_url":"https://api.github.com/repos/code-dot-org/code-dot-org/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/code-dot-org/code-dot-org/teams","hooks_url":"https://api.github.com/repos/code-dot-org/code-dot-org/hooks","issue_events_url":"https://api.github.com/repos/code-dot-org/code-dot-org/issues/events{/number}","events_url":"https://api.github.com/repos/code-dot-org/code-dot-org/events","assignees_url":"https://api.github.com/repos/code-dot-org/code-dot-org/assignees{/user}","branches_url":"https://api.github.com/repos/code-dot-org/code-dot-org/branches{/branch}","tags_url":"https://api.github.com/repos/code-dot-org/code-dot-org/tags","blobs_url":"https://api.github.com/repos/code-dot-org/code-dot-org/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/code-dot-org/code-dot-org/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/code-dot-org/code-dot-org/git/refs{/sha}","trees_url":"https://api.github.com/repos/code-dot-org/code-dot-org/git/trees{/sha}","statuses_url":"https://api.github.com/repos/code-dot-org/code-dot-org/statuses/{sha}","languages_url":"https://api.github.com/repos/code-dot-org/code-dot-org/languages","stargazers_url":"https://api.github.com/repos/code-dot-org/code-dot-org/stargazers","contributors_url":"https://api.github.com/repos/code-dot-org/code-dot-org/contributors","subscribers_url":"https://api.github.com/repos/code-dot-org/code-dot-org/subscribers","subscription_url":"https://api.github.com/repos/code-dot-org/code-dot-org/subscription","commits_url":"https://api.github.com/repos/code-dot-org/code-dot-org/commits{/sha}","git_commits_url":"https://api.github.com/repos/code-dot-org/code-dot-org/git/commits{/sha}","comments_url":"https://api.github.com/repos/code-dot-org/code-dot-org/comments{/number}","issue_comment_url":"https://api.github.com/repos/code-dot-org/code-dot-org/issues/comments{/number}","contents_url":"https://api.github.com/repos/code-dot-org/code-dot-org/contents/{+path}","compare_url":"https://api.github.com/repos/code-dot-org/code-dot-org/compare/{base}...{head}","merges_url":"https://api.github.com/repos/code-dot-org/code-dot-org/merges","archive_url":"https://api.github.com/repos/code-dot-org/code-dot-org/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/code-dot-org/code-dot-org/downloads","issues_url":"https://api.github.com/repos/code-dot-org/code-dot-org/issues{/number}","pulls_url":"https://api.github.com/repos/code-dot-org/code-dot-org/pulls{/number}","milestones_url":"https://api.github.com/repos/code-dot-org/code-dot-org/milestones{/number}","notifications_url":"https://api.github.com/repos/code-dot-org/code-dot-org/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/code-dot-org/code-dot-org/labels{/name}","releases_url":"https://api.github.com/repos/code-dot-org/code-dot-org/releases{/id}","created_at":"2014-09-20T00:46:11Z","updated_at":"2015-03-17T01:00:18Z","pushed_at":"2015-03-17T01:00:18Z","git_url":"git://github.com/code-dot-org/code-dot-org.git","ssh_url":"git@github.com:code-dot-org/code-dot-org.git","clone_url":"https://github.com/code-dot-org/code-dot-org.git","svn_url":"https://github.com/code-dot-org/code-dot-org","homepage":"http://code.org","size":1758297,"stargazers_count":27,"watchers_count":27,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":21,"mirror_url":null,"open_issues_count":25,"forks":21,"open_issues":25,"watchers":27,"default_branch":"staging"}},"_links":{"self":{"href":"https://api.github.com/repos/code-dot-org/code-dot-org/pulls/1536"},"html":{"href":"https://github.com/code-dot-org/code-dot-org/pull/1536"},"issue":{"href":"https://api.github.com/repos/code-dot-org/code-dot-org/issues/1536"},"comments":{"href":"https://api.github.com/repos/code-dot-org/code-dot-org/issues/1536/comments"},"review_comments":{"href":"https://api.github.com/repos/code-dot-org/code-dot-org/pulls/1536/comments"},"review_comment":{"href":"https://api.github.com/repos/code-dot-org/code-dot-org/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/code-dot-org/code-dot-org/pulls/1536/commits"},"statuses":{"href":"https://api.github.com/repos/code-dot-org/code-dot-org/statuses/aa66afabb1e5c4f71ec3c3e51c362ea8d4c7a855"}}}}