GitHub PullRequestReviewCommentEvent at 2014-03-10 06:58:04
Repository: remo
Actor: prameet-jain
Payload: {"comment":{"url":"https://api.github.com/repos/mozilla/remo/pulls/comments/10420350","id":10420350,"diff_hunk":"@@ -123,19 +123,49 @@\n                                     </a>\n                                   </td>\n                                   <td>\n-                                    {{ count_ng_reports(report.user, current_streak=True) }} days\n+                                    {% set day_count=count_ng_reports(report.user, current_streak=True) %}\n+                                    {% if day_count > 0 %}\n+                                      {{ day_count }}&nbsp;\n+                                      {% if day_count == 1 %}day{% else %}days{% endif %}\n+                                    {% else %}\n+                                      0\n+                                    {% endif %}\n                                   </td>\n                                   <td>\n-                                    {{ count_ng_reports(report.user, longest_streak=True) }} days\n+                                    {% set day_count=count_ng_reports(report.user, longest_streak=True) %}\n+                                    {% if day_count > 0 %}\n+                                      {{ day_count }}&nbsp;\n+                                      {% if day_count == 1 %}day{% else %}days{% endif %}\n+                                    {% else %}\n+                                      0\n+                                    {% endif %}\n                                   </td>\n                                   <td>\n-                                    {{ count_ng_reports(report.user, period=2) }} activities\n+                                    {% set activity_count=count_ng_reports(report.user, period=2) %}\n+                                    {% if activity_count > 0 %}\n+                                      {{ activity_count }}&nbsp;\n+                                      {% if activity_count == 1 %}activity{% else %}activities{% endif %}\n+                                    {% else %}\n+                                      0\n+                                    {% endif %}\n                                   </td>","path":"remo/base/templates/dashboard_mozillians.html","position":32,"original_position":32,"commit_id":"d529cb15ff749c5f130528b17bb791402c7e34af","original_commit_id":"d529cb15ff749c5f130528b17bb791402c7e34af","user":{"login":"prameet-jain","id":6178374,"avatar_url":"https://gravatar.com/avatar/c6280d3095eda42a22cff2a4d74cb879?d=https%3A%2F%2Fidenticons.github.com%2F181d7aeb58bca37e7e2564d7c11e893e.png&r=x","gravatar_id":"c6280d3095eda42a22cff2a4d74cb879","url":"https://api.github.com/users/prameet-jain","html_url":"https://github.com/prameet-jain","followers_url":"https://api.github.com/users/prameet-jain/followers","following_url":"https://api.github.com/users/prameet-jain/following{/other_user}","gists_url":"https://api.github.com/users/prameet-jain/gists{/gist_id}","starred_url":"https://api.github.com/users/prameet-jain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prameet-jain/subscriptions","organizations_url":"https://api.github.com/users/prameet-jain/orgs","repos_url":"https://api.github.com/users/prameet-jain/repos","events_url":"https://api.github.com/users/prameet-jain/events{/privacy}","received_events_url":"https://api.github.com/users/prameet-jain/received_events","type":"User","site_admin":false},"body":"Hi Reviewer,\r\n\r\nAfter a thorough look into this helper method 'count_ng_reports', I understood that the return value in this method will always be a positive numeric value. In such case the above changes can be optimized like below:\r\n<td>\r\n       {% set activity_count=count_ng_reports(report.user, period=2) %}\r\n       {{ activity_count }}&nbsp;\r\n       {% if activity_count == 1 %}activity{% else %}activities{% endif %}\r\n</td>\r\n\r\nPlease review this and let me know if my understanding is correct or not. If this is true, I can make the proposed changes and re-submit the PR.\r\n\r\n-Prameet","created_at":"2014-03-10T06:58:04Z","updated_at":"2014-03-10T06:58:04Z","html_url":"https://github.com/mozilla/remo/pull/661#discussion_r10420350","pull_request_url":"https://api.github.com/repos/mozilla/remo/pulls/661","_links":{"self":{"href":"https://api.github.com/repos/mozilla/remo/pulls/comments/10420350"},"html":{"href":"https://github.com/mozilla/remo/pull/661#discussion_r10420350"},"pull_request":{"href":"https://api.github.com/repos/mozilla/remo/pulls/661"}}}}