{"action":"created","comment":{"url":"https://api.github.com/repos/ga-dc/garnet/pulls/comments/51578639","id":51578639,"diff_hunk":"@@ -25,29 +25,38 @@ def average_status collection\n    end\n   end\n \n-  def color_of_percent input\n+  def color_of_percent input, type = :good\n+    # can't do calculations on nil values\n+    return \"\" if input.nil?\n+\n+    # if the input is a 'bad' value, flip and scale the value accordingly.\n+    # e.g. a good value would be %HW complete, and 75% would be green\n+    #\n+    # but a bad value might be \"% absent\", and 10% would be yellow\n+    input = (100 - (input* 3)) if type == :bad\n+\n     case input\n-    when 0...25\n-      return \"s0\"\n+    when -1000...25\n+      return \"status_very_bad\"\n     when 25...50\n-      return \"s1\"\n+      return \"status_bad\"\n     when 50...75\n-      return \"s2\"\n-    when 75..100\n-      return \"s3\"\n+      return \"status_mediocre\"\n+    when 75..1000\n+      return \"status_good\"","path":"app/helpers/application_helper.rb","position":29,"original_position":29,"commit_id":"aab5863b70b0ade74f1a7ba295b8925b02caba45","original_commit_id":"aab5863b70b0ade74f1a7ba295b8925b02caba45","user":{"login":"adambray","id":75565,"avatar_url":"https://avatars.githubusercontent.com/u/75565?v=3","gravatar_id":"","url":"https://api.github.com/users/adambray","html_url":"https://github.com/adambray","followers_url":"https://api.github.com/users/adambray/followers","following_url":"https://api.github.com/users/adambray/following{/other_user}","gists_url":"https://api.github.com/users/adambray/gists{/gist_id}","starred_url":"https://api.github.com/users/adambray/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adambray/subscriptions","organizations_url":"https://api.github.com/users/adambray/orgs","repos_url":"https://api.github.com/users/adambray/repos","events_url":"https://api.github.com/users/adambray/events{/privacy}","received_events_url":"https://api.github.com/users/adambray/received_events","type":"User","site_admin":false},"body":"Printing CSS classes using ERB is a pretty common pattern that I've seen... and in this case, this change isn't introducing that... it was already printing CSS classes... this PR just renames the classes to be more clear.\r\n\r\nUsing `data-status` would require JS just to apply the styles, which would introduce additional complexity and indirection.","created_at":"2016-02-02T14:58:37Z","updated_at":"2016-02-02T14:58:37Z","html_url":"https://github.com/ga-dc/garnet/pull/398#discussion_r51578639","pull_request_url":"https://api.github.com/repos/ga-dc/garnet/pulls/398","_links":{"self":{"href":"https://api.github.com/repos/ga-dc/garnet/pulls/comments/51578639"},"html":{"href":"https://github.com/ga-dc/garnet/pull/398#discussion_r51578639"},"pull_request":{"href":"https://api.github.com/repos/ga-dc/garnet/pulls/398"}}},"pull_request":{"url":"https://api.github.com/repos/ga-dc/garnet/pulls/398","id":57920872,"html_url":"https://github.com/ga-dc/garnet/pull/398","diff_url":"https://github.com/ga-dc/garnet/pull/398.diff","patch_url":"https://github.com/ga-dc/garnet/pull/398.patch","issue_url":"https://api.github.com/repos/ga-dc/garnet/issues/398","number":398,"state":"open","locked":false,"title":"adjusts color in membership table to invert if value is negative","user":{"login":"adambray","id":75565,"avatar_url":"https://avatars.githubusercontent.com/u/75565?v=3","gravatar_id":"","url":"https://api.github.com/users/adambray","html_url":"https://github.com/adambray","followers_url":"https://api.github.com/users/adambray/followers","following_url":"https://api.github.com/users/adambray/following{/other_user}","gists_url":"https://api.github.com/users/adambray/gists{/gist_id}","starred_url":"https://api.github.com/users/adambray/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adambray/subscriptions","organizations_url":"https://api.github.com/users/adambray/orgs","repos_url":"https://api.github.com/users/adambray/repos","events_url":"https://api.github.com/users/adambray/events{/privacy}","received_events_url":"https://api.github.com/users/adambray/received_events","type":"User","site_admin":false},"body":"e.g. tardiness","created_at":"2016-02-02T00:03:04Z","updated_at":"2016-02-02T14:58:37Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b94a4d315d6148b23921a291f0a312364fcf8c7d","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ga-dc/garnet/pulls/398/commits","review_comments_url":"https://api.github.com/repos/ga-dc/garnet/pulls/398/comments","review_comment_url":"https://api.github.com/repos/ga-dc/garnet/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ga-dc/garnet/issues/398/comments","statuses_url":"https://api.github.com/repos/ga-dc/garnet/statuses/aab5863b70b0ade74f1a7ba295b8925b02caba45","head":{"label":"ga-dc:fix_performance_colors","ref":"fix_performance_colors","sha":"aab5863b70b0ade74f1a7ba295b8925b02caba45","user":{"login":"ga-dc","id":10747017,"avatar_url":"https://avatars.githubusercontent.com/u/10747017?v=3","gravatar_id":"","url":"https://api.github.com/users/ga-dc","html_url":"https://github.com/ga-dc","followers_url":"https://api.github.com/users/ga-dc/followers","following_url":"https://api.github.com/users/ga-dc/following{/other_user}","gists_url":"https://api.github.com/users/ga-dc/gists{/gist_id}","starred_url":"https://api.github.com/users/ga-dc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ga-dc/subscriptions","organizations_url":"https://api.github.com/users/ga-dc/orgs","repos_url":"https://api.github.com/users/ga-dc/repos","events_url":"https://api.github.com/users/ga-dc/events{/privacy}","received_events_url":"https://api.github.com/users/ga-dc/received_events","type":"Organization","site_admin":false},"repo":{"id":43320430,"name":"garnet","full_name":"ga-dc/garnet","owner":{"login":"ga-dc","id":10747017,"avatar_url":"https://avatars.githubusercontent.com/u/10747017?v=3","gravatar_id":"","url":"https://api.github.com/users/ga-dc","html_url":"https://github.com/ga-dc","followers_url":"https://api.github.com/users/ga-dc/followers","following_url":"https://api.github.com/users/ga-dc/following{/other_user}","gists_url":"https://api.github.com/users/ga-dc/gists{/gist_id}","starred_url":"https://api.github.com/users/ga-dc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ga-dc/subscriptions","organizations_url":"https://api.github.com/users/ga-dc/orgs","repos_url":"https://api.github.com/users/ga-dc/repos","events_url":"https://api.github.com/users/ga-dc/events{/privacy}","received_events_url":"https://api.github.com/users/ga-dc/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ga-dc/garnet","description":"Classroom Management tools","fork":false,"url":"https://api.github.com/repos/ga-dc/garnet","forks_url":"https://api.github.com/repos/ga-dc/garnet/forks","keys_url":"https://api.github.com/repos/ga-dc/garnet/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ga-dc/garnet/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ga-dc/garnet/teams","hooks_url":"https://api.github.com/repos/ga-dc/garnet/hooks","issue_events_url":"https://api.github.com/repos/ga-dc/garnet/issues/events{/number}","events_url":"https://api.github.com/repos/ga-dc/garnet/events","assignees_url":"https://api.github.com/repos/ga-dc/garnet/assignees{/user}","branches_url":"https://api.github.com/repos/ga-dc/garnet/branches{/branch}","tags_url":"https://api.github.com/repos/ga-dc/garnet/tags","blobs_url":"https://api.github.com/repos/ga-dc/garnet/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ga-dc/garnet/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ga-dc/garnet/git/refs{/sha}","trees_url":"https://api.github.com/repos/ga-dc/garnet/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ga-dc/garnet/statuses/{sha}","languages_url":"https://api.github.com/repos/ga-dc/garnet/languages","stargazers_url":"https://api.github.com/repos/ga-dc/garnet/stargazers","contributors_url":"https://api.github.com/repos/ga-dc/garnet/contributors","subscribers_url":"https://api.github.com/repos/ga-dc/garnet/subscribers","subscription_url":"https://api.github.com/repos/ga-dc/garnet/subscription","commits_url":"https://api.github.com/repos/ga-dc/garnet/commits{/sha}","git_commits_url":"https://api.github.com/repos/ga-dc/garnet/git/commits{/sha}","comments_url":"https://api.github.com/repos/ga-dc/garnet/comments{/number}","issue_comment_url":"https://api.github.com/repos/ga-dc/garnet/issues/comments{/number}","contents_url":"https://api.github.com/repos/ga-dc/garnet/contents/{+path}","compare_url":"https://api.github.com/repos/ga-dc/garnet/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ga-dc/garnet/merges","archive_url":"https://api.github.com/repos/ga-dc/garnet/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ga-dc/garnet/downloads","issues_url":"https://api.github.com/repos/ga-dc/garnet/issues{/number}","pulls_url":"https://api.github.com/repos/ga-dc/garnet/pulls{/number}","milestones_url":"https://api.github.com/repos/ga-dc/garnet/milestones{/number}","notifications_url":"https://api.github.com/repos/ga-dc/garnet/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ga-dc/garnet/labels{/name}","releases_url":"https://api.github.com/repos/ga-dc/garnet/releases{/id}","deployments_url":"https://api.github.com/repos/ga-dc/garnet/deployments","created_at":"2015-09-28T18:56:26Z","updated_at":"2016-01-29T20:29:13Z","pushed_at":"2016-02-02T14:37:18Z","git_url":"git://github.com/ga-dc/garnet.git","ssh_url":"git@github.com:ga-dc/garnet.git","clone_url":"https://github.com/ga-dc/garnet.git","svn_url":"https://github.com/ga-dc/garnet","homepage":"http://garnet.wdidc.org","size":1041,"stargazers_count":4,"watchers_count":4,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":7,"mirror_url":null,"open_issues_count":30,"forks":7,"open_issues":30,"watchers":4,"default_branch":"master"}},"base":{"label":"ga-dc:master","ref":"master","sha":"70b83140710eda95f8c1512c9b9f6db7e5280143","user":{"login":"ga-dc","id":10747017,"avatar_url":"https://avatars.githubusercontent.com/u/10747017?v=3","gravatar_id":"","url":"https://api.github.com/users/ga-dc","html_url":"https://github.com/ga-dc","followers_url":"https://api.github.com/users/ga-dc/followers","following_url":"https://api.github.com/users/ga-dc/following{/other_user}","gists_url":"https://api.github.com/users/ga-dc/gists{/gist_id}","starred_url":"https://api.github.com/users/ga-dc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ga-dc/subscriptions","organizations_url":"https://api.github.com/users/ga-dc/orgs","repos_url":"https://api.github.com/users/ga-dc/repos","events_url":"https://api.github.com/users/ga-dc/events{/privacy}","received_events_url":"https://api.github.com/users/ga-dc/received_events","type":"Organization","site_admin":false},"repo":{"id":43320430,"name":"garnet","full_name":"ga-dc/garnet","owner":{"login":"ga-dc","id":10747017,"avatar_url":"https://avatars.githubusercontent.com/u/10747017?v=3","gravatar_id":"","url":"https://api.github.com/users/ga-dc","html_url":"https://github.com/ga-dc","followers_url":"https://api.github.com/users/ga-dc/followers","following_url":"https://api.github.com/users/ga-dc/following{/other_user}","gists_url":"https://api.github.com/users/ga-dc/gists{/gist_id}","starred_url":"https://api.github.com/users/ga-dc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ga-dc/subscriptions","organizations_url":"https://api.github.com/users/ga-dc/orgs","repos_url":"https://api.github.com/users/ga-dc/repos","events_url":"https://api.github.com/users/ga-dc/events{/privacy}","received_events_url":"https://api.github.com/users/ga-dc/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ga-dc/garnet","description":"Classroom Management tools","fork":false,"url":"https://api.github.com/repos/ga-dc/garnet","forks_url":"https://api.github.com/repos/ga-dc/garnet/forks","keys_url":"https://api.github.com/repos/ga-dc/garnet/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ga-dc/garnet/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ga-dc/garnet/teams","hooks_url":"https://api.github.com/repos/ga-dc/garnet/hooks","issue_events_url":"https://api.github.com/repos/ga-dc/garnet/issues/events{/number}","events_url":"https://api.github.com/repos/ga-dc/garnet/events","assignees_url":"https://api.github.com/repos/ga-dc/garnet/assignees{/user}","branches_url":"https://api.github.com/repos/ga-dc/garnet/branches{/branch}","tags_url":"https://api.github.com/repos/ga-dc/garnet/tags","blobs_url":"https://api.github.com/repos/ga-dc/garnet/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ga-dc/garnet/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ga-dc/garnet/git/refs{/sha}","trees_url":"https://api.github.com/repos/ga-dc/garnet/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ga-dc/garnet/statuses/{sha}","languages_url":"https://api.github.com/repos/ga-dc/garnet/languages","stargazers_url":"https://api.github.com/repos/ga-dc/garnet/stargazers","contributors_url":"https://api.github.com/repos/ga-dc/garnet/contributors","subscribers_url":"https://api.github.com/repos/ga-dc/garnet/subscribers","subscription_url":"https://api.github.com/repos/ga-dc/garnet/subscription","commits_url":"https://api.github.com/repos/ga-dc/garnet/commits{/sha}","git_commits_url":"https://api.github.com/repos/ga-dc/garnet/git/commits{/sha}","comments_url":"https://api.github.com/repos/ga-dc/garnet/comments{/number}","issue_comment_url":"https://api.github.com/repos/ga-dc/garnet/issues/comments{/number}","contents_url":"https://api.github.com/repos/ga-dc/garnet/contents/{+path}","compare_url":"https://api.github.com/repos/ga-dc/garnet/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ga-dc/garnet/merges","archive_url":"https://api.github.com/repos/ga-dc/garnet/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ga-dc/garnet/downloads","issues_url":"https://api.github.com/repos/ga-dc/garnet/issues{/number}","pulls_url":"https://api.github.com/repos/ga-dc/garnet/pulls{/number}","milestones_url":"https://api.github.com/repos/ga-dc/garnet/milestones{/number}","notifications_url":"https://api.github.com/repos/ga-dc/garnet/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ga-dc/garnet/labels{/name}","releases_url":"https://api.github.com/repos/ga-dc/garnet/releases{/id}","deployments_url":"https://api.github.com/repos/ga-dc/garnet/deployments","created_at":"2015-09-28T18:56:26Z","updated_at":"2016-01-29T20:29:13Z","pushed_at":"2016-02-02T14:37:18Z","git_url":"git://github.com/ga-dc/garnet.git","ssh_url":"git@github.com:ga-dc/garnet.git","clone_url":"https://github.com/ga-dc/garnet.git","svn_url":"https://github.com/ga-dc/garnet","homepage":"http://garnet.wdidc.org","size":1041,"stargazers_count":4,"watchers_count":4,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":7,"mirror_url":null,"open_issues_count":30,"forks":7,"open_issues":30,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ga-dc/garnet/pulls/398"},"html":{"href":"https://github.com/ga-dc/garnet/pull/398"},"issue":{"href":"https://api.github.com/repos/ga-dc/garnet/issues/398"},"comments":{"href":"https://api.github.com/repos/ga-dc/garnet/issues/398/comments"},"review_comments":{"href":"https://api.github.com/repos/ga-dc/garnet/pulls/398/comments"},"review_comment":{"href":"https://api.github.com/repos/ga-dc/garnet/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ga-dc/garnet/pulls/398/commits"},"statuses":{"href":"https://api.github.com/repos/ga-dc/garnet/statuses/aab5863b70b0ade74f1a7ba295b8925b02caba45"}}}}