{"action":"created","comment":{"url":"https://api.github.com/repos/DoSomething/gladiator/pulls/comments/86602006","pull_request_review_id":7255188,"id":86602006,"diff_hunk":"@@ -322,36 +323,92 @@ public function appendReportback($data, $parameters)\n \n     /**\n      * Get the top three reportbacks from a given leaderboard.\n-     * Adds custom info about each placement for display.\n+     * Adds custom info based on options passed in.\n      *\n-     * @param array $leaderboard\n+     * @param array $leaderboard, array $options\n      * @return array $topThree\n      */\n-    public function getTopThreeReportbacks($leaderboard)\n+    public function getTopThreeReportbacks($leaderboard, $options = [])\n     {\n         $topThreeUsers = array_slice($leaderboard, 0, 3);\n         $places = ['1st', '2nd', '3rd'];\n         $prizeCopy = ['Taking home the $100 AMEX gift card', 'Winner of the $50 amex gift card', 'Winner of the $25 amex gift card'];\n \n         $topThree = [];\n+        $includeUserIds = false;\n+        $hasCompetitionId = false;\n+        $hasMessageId = false;\n \n-        foreach ($topThreeUsers as $key => $user) {\n-            $reportbackItems = $user->reportback->reportback_items->data;\n-            $latestReportbackItem = array_pop($reportbackItems);\n+        if (isset($options['includeUserIds']) && $options['includeUserIds']) {\n+            $includeUserIds = true;\n+        }\n+\n+        if (isset($options['competition_id']) && isset($options['message_id'])) {","path":"app/Services/Manager.php","position":38,"original_position":38,"commit_id":"fe220e2fdc21fba72e9eda1b7e913053e4119545","original_commit_id":"fe220e2fdc21fba72e9eda1b7e913053e4119545","user":{"login":"sbsmith86","id":1700409,"avatar_url":"https://avatars.githubusercontent.com/u/1700409?v=3","gravatar_id":"","url":"https://api.github.com/users/sbsmith86","html_url":"https://github.com/sbsmith86","followers_url":"https://api.github.com/users/sbsmith86/followers","following_url":"https://api.github.com/users/sbsmith86/following{/other_user}","gists_url":"https://api.github.com/users/sbsmith86/gists{/gist_id}","starred_url":"https://api.github.com/users/sbsmith86/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sbsmith86/subscriptions","organizations_url":"https://api.github.com/users/sbsmith86/orgs","repos_url":"https://api.github.com/users/sbsmith86/repos","events_url":"https://api.github.com/users/sbsmith86/events{/privacy}","received_events_url":"https://api.github.com/users/sbsmith86/received_events","type":"User","site_admin":false},"body":"Same here. ","created_at":"2016-11-04T18:05:08Z","updated_at":"2016-11-04T18:05:08Z","html_url":"https://github.com/DoSomething/gladiator/pull/350#discussion_r86602006","pull_request_url":"https://api.github.com/repos/DoSomething/gladiator/pulls/350","_links":{"self":{"href":"https://api.github.com/repos/DoSomething/gladiator/pulls/comments/86602006"},"html":{"href":"https://github.com/DoSomething/gladiator/pull/350#discussion_r86602006"},"pull_request":{"href":"https://api.github.com/repos/DoSomething/gladiator/pulls/350"}}},"pull_request":{"url":"https://api.github.com/repos/DoSomething/gladiator/pulls/350","id":92371604,"html_url":"https://github.com/DoSomething/gladiator/pull/350","diff_url":"https://github.com/DoSomething/gladiator/pull/350.diff","patch_url":"https://github.com/DoSomething/gladiator/pull/350.patch","issue_url":"https://api.github.com/repos/DoSomething/gladiator/issues/350","number":350,"state":"open","locked":false,"title":"Leaderboard photos","user":{"login":"LindaOrtega","id":10335533,"avatar_url":"https://avatars.githubusercontent.com/u/10335533?v=3","gravatar_id":"","url":"https://api.github.com/users/LindaOrtega","html_url":"https://github.com/LindaOrtega","followers_url":"https://api.github.com/users/LindaOrtega/followers","following_url":"https://api.github.com/users/LindaOrtega/following{/other_user}","gists_url":"https://api.github.com/users/LindaOrtega/gists{/gist_id}","starred_url":"https://api.github.com/users/LindaOrtega/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LindaOrtega/subscriptions","organizations_url":"https://api.github.com/users/LindaOrtega/orgs","repos_url":"https://api.github.com/users/LindaOrtega/repos","events_url":"https://api.github.com/users/LindaOrtega/events{/privacy}","received_events_url":"https://api.github.com/users/LindaOrtega/received_events","type":"User","site_admin":false},"body":"#### What's this PR do?\r\nFor each of the top three users, this PR allows admin to choose which of the user's reportback item images will appear in leaderboard emails.\r\n\r\n#### How should this be manually tested?\r\nNavigate to a contest. Go to Email Settings. Check \"Show Images\" for all leaderboard emails that will be testing. Return to contest page and select a competition. Select \"Set Photos\" for a leaderboard email and enter the fid to feature for specific user. Should check the following test-scenarios:\r\n\r\n     1. If Admin leaves fid field empty for user(s) and submits form, the db rows for those/that user(s) should not change and the test email should feature default (most recent) reportback item image for those/that user(s). \r\n\r\n     2. If Admin changes the fid for a user already present in db, the db row associated with that user should change. \r\n\r\n     3. If Admin enters incorrect fid for specific user/reportback, test email should show default reportback item image (the most recent one).\r\n\r\n     4. If Admin enters correct fid for specified user/reportback, test email should show the selected reportback item image. \r\n\r\n     5. If Admin enters valid fid for specified user/reportback and for email type 1 but not for email type 2, the test email for email type 2 should not show the reportback item image entered for email type 1. \r\n\r\n#### Any background context you want to provide?\r\nPR composed of two parts: \r\n1) The process of editing/updating leaderboard_photos db\r\n2) The process of composing leaderboard emails using the reportback item images present in this db. \r\n\r\n#### What are the relevant tickets?\r\nFixes #333 ","created_at":"2016-11-04T16:23:07Z","updated_at":"2016-11-04T18:05:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"52c9e588c5705f77126be5f64630287395c1defb","assignee":{"login":"sbsmith86","id":1700409,"avatar_url":"https://avatars.githubusercontent.com/u/1700409?v=3","gravatar_id":"","url":"https://api.github.com/users/sbsmith86","html_url":"https://github.com/sbsmith86","followers_url":"https://api.github.com/users/sbsmith86/followers","following_url":"https://api.github.com/users/sbsmith86/following{/other_user}","gists_url":"https://api.github.com/users/sbsmith86/gists{/gist_id}","starred_url":"https://api.github.com/users/sbsmith86/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sbsmith86/subscriptions","organizations_url":"https://api.github.com/users/sbsmith86/orgs","repos_url":"https://api.github.com/users/sbsmith86/repos","events_url":"https://api.github.com/users/sbsmith86/events{/privacy}","received_events_url":"https://api.github.com/users/sbsmith86/received_events","type":"User","site_admin":false},"assignees":[{"login":"sbsmith86","id":1700409,"avatar_url":"https://avatars.githubusercontent.com/u/1700409?v=3","gravatar_id":"","url":"https://api.github.com/users/sbsmith86","html_url":"https://github.com/sbsmith86","followers_url":"https://api.github.com/users/sbsmith86/followers","following_url":"https://api.github.com/users/sbsmith86/following{/other_user}","gists_url":"https://api.github.com/users/sbsmith86/gists{/gist_id}","starred_url":"https://api.github.com/users/sbsmith86/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sbsmith86/subscriptions","organizations_url":"https://api.github.com/users/sbsmith86/orgs","repos_url":"https://api.github.com/users/sbsmith86/repos","events_url":"https://api.github.com/users/sbsmith86/events{/privacy}","received_events_url":"https://api.github.com/users/sbsmith86/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/DoSomething/gladiator/milestones/6","html_url":"https://github.com/DoSomething/gladiator/milestones/Gladiator%202.0","labels_url":"https://api.github.com/repos/DoSomething/gladiator/milestones/6/labels","id":1993816,"number":6,"title":"Gladiator 2.0","description":"","creator":{"login":"ngjo","id":2658867,"avatar_url":"https://avatars.githubusercontent.com/u/2658867?v=3","gravatar_id":"","url":"https://api.github.com/users/ngjo","html_url":"https://github.com/ngjo","followers_url":"https://api.github.com/users/ngjo/followers","following_url":"https://api.github.com/users/ngjo/following{/other_user}","gists_url":"https://api.github.com/users/ngjo/gists{/gist_id}","starred_url":"https://api.github.com/users/ngjo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ngjo/subscriptions","organizations_url":"https://api.github.com/users/ngjo/orgs","repos_url":"https://api.github.com/users/ngjo/repos","events_url":"https://api.github.com/users/ngjo/events{/privacy}","received_events_url":"https://api.github.com/users/ngjo/received_events","type":"User","site_admin":false},"open_issues":12,"closed_issues":4,"state":"open","created_at":"2016-09-09T16:02:24Z","updated_at":"2016-11-04T16:23:07Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/DoSomething/gladiator/pulls/350/commits","review_comments_url":"https://api.github.com/repos/DoSomething/gladiator/pulls/350/comments","review_comment_url":"https://api.github.com/repos/DoSomething/gladiator/pulls/comments{/number}","comments_url":"https://api.github.com/repos/DoSomething/gladiator/issues/350/comments","statuses_url":"https://api.github.com/repos/DoSomething/gladiator/statuses/fe220e2fdc21fba72e9eda1b7e913053e4119545","head":{"label":"DoSomething:leaderboard_photos","ref":"leaderboard_photos","sha":"fe220e2fdc21fba72e9eda1b7e913053e4119545","user":{"login":"DoSomething","id":731685,"avatar_url":"https://avatars.githubusercontent.com/u/731685?v=3","gravatar_id":"","url":"https://api.github.com/users/DoSomething","html_url":"https://github.com/DoSomething","followers_url":"https://api.github.com/users/DoSomething/followers","following_url":"https://api.github.com/users/DoSomething/following{/other_user}","gists_url":"https://api.github.com/users/DoSomething/gists{/gist_id}","starred_url":"https://api.github.com/users/DoSomething/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DoSomething/subscriptions","organizations_url":"https://api.github.com/users/DoSomething/orgs","repos_url":"https://api.github.com/users/DoSomething/repos","events_url":"https://api.github.com/users/DoSomething/events{/privacy}","received_events_url":"https://api.github.com/users/DoSomething/received_events","type":"Organization","site_admin":false},"repo":{"id":51176505,"name":"gladiator","full_name":"DoSomething/gladiator","owner":{"login":"DoSomething","id":731685,"avatar_url":"https://avatars.githubusercontent.com/u/731685?v=3","gravatar_id":"","url":"https://api.github.com/users/DoSomething","html_url":"https://github.com/DoSomething","followers_url":"https://api.github.com/users/DoSomething/followers","following_url":"https://api.github.com/users/DoSomething/following{/other_user}","gists_url":"https://api.github.com/users/DoSomething/gists{/gist_id}","starred_url":"https://api.github.com/users/DoSomething/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DoSomething/subscriptions","organizations_url":"https://api.github.com/users/DoSomething/orgs","repos_url":"https://api.github.com/users/DoSomething/repos","events_url":"https://api.github.com/users/DoSomething/events{/privacy}","received_events_url":"https://api.github.com/users/DoSomething/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/DoSomething/gladiator","description":":guardsman: The DoSomething.org competitions platform.","fork":false,"url":"https://api.github.com/repos/DoSomething/gladiator","forks_url":"https://api.github.com/repos/DoSomething/gladiator/forks","keys_url":"https://api.github.com/repos/DoSomething/gladiator/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DoSomething/gladiator/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DoSomething/gladiator/teams","hooks_url":"https://api.github.com/repos/DoSomething/gladiator/hooks","issue_events_url":"https://api.github.com/repos/DoSomething/gladiator/issues/events{/number}","events_url":"https://api.github.com/repos/DoSomething/gladiator/events","assignees_url":"https://api.github.com/repos/DoSomething/gladiator/assignees{/user}","branches_url":"https://api.github.com/repos/DoSomething/gladiator/branches{/branch}","tags_url":"https://api.github.com/repos/DoSomething/gladiator/tags","blobs_url":"https://api.github.com/repos/DoSomething/gladiator/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DoSomething/gladiator/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DoSomething/gladiator/git/refs{/sha}","trees_url":"https://api.github.com/repos/DoSomething/gladiator/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DoSomething/gladiator/statuses/{sha}","languages_url":"https://api.github.com/repos/DoSomething/gladiator/languages","stargazers_url":"https://api.github.com/repos/DoSomething/gladiator/stargazers","contributors_url":"https://api.github.com/repos/DoSomething/gladiator/contributors","subscribers_url":"https://api.github.com/repos/DoSomething/gladiator/subscribers","subscription_url":"https://api.github.com/repos/DoSomething/gladiator/subscription","commits_url":"https://api.github.com/repos/DoSomething/gladiator/commits{/sha}","git_commits_url":"https://api.github.com/repos/DoSomething/gladiator/git/commits{/sha}","comments_url":"https://api.github.com/repos/DoSomething/gladiator/comments{/number}","issue_comment_url":"https://api.github.com/repos/DoSomething/gladiator/issues/comments{/number}","contents_url":"https://api.github.com/repos/DoSomething/gladiator/contents/{+path}","compare_url":"https://api.github.com/repos/DoSomething/gladiator/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DoSomething/gladiator/merges","archive_url":"https://api.github.com/repos/DoSomething/gladiator/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DoSomething/gladiator/downloads","issues_url":"https://api.github.com/repos/DoSomething/gladiator/issues{/number}","pulls_url":"https://api.github.com/repos/DoSomething/gladiator/pulls{/number}","milestones_url":"https://api.github.com/repos/DoSomething/gladiator/milestones{/number}","notifications_url":"https://api.github.com/repos/DoSomething/gladiator/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DoSomething/gladiator/labels{/name}","releases_url":"https://api.github.com/repos/DoSomething/gladiator/releases{/id}","deployments_url":"https://api.github.com/repos/DoSomething/gladiator/deployments","created_at":"2016-02-05T21:53:32Z","updated_at":"2016-07-07T14:09:38Z","pushed_at":"2016-11-04T16:45:37Z","git_url":"git://github.com/DoSomething/gladiator.git","ssh_url":"git@github.com:DoSomething/gladiator.git","clone_url":"https://github.com/DoSomething/gladiator.git","svn_url":"https://github.com/DoSomething/gladiator","homepage":"","size":856,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":21,"forks":0,"open_issues":21,"watchers":0,"default_branch":"master"}},"base":{"label":"DoSomething:master","ref":"master","sha":"6dc2bc1dccb6b5307793925b4221fe6a2efd2436","user":{"login":"DoSomething","id":731685,"avatar_url":"https://avatars.githubusercontent.com/u/731685?v=3","gravatar_id":"","url":"https://api.github.com/users/DoSomething","html_url":"https://github.com/DoSomething","followers_url":"https://api.github.com/users/DoSomething/followers","following_url":"https://api.github.com/users/DoSomething/following{/other_user}","gists_url":"https://api.github.com/users/DoSomething/gists{/gist_id}","starred_url":"https://api.github.com/users/DoSomething/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DoSomething/subscriptions","organizations_url":"https://api.github.com/users/DoSomething/orgs","repos_url":"https://api.github.com/users/DoSomething/repos","events_url":"https://api.github.com/users/DoSomething/events{/privacy}","received_events_url":"https://api.github.com/users/DoSomething/received_events","type":"Organization","site_admin":false},"repo":{"id":51176505,"name":"gladiator","full_name":"DoSomething/gladiator","owner":{"login":"DoSomething","id":731685,"avatar_url":"https://avatars.githubusercontent.com/u/731685?v=3","gravatar_id":"","url":"https://api.github.com/users/DoSomething","html_url":"https://github.com/DoSomething","followers_url":"https://api.github.com/users/DoSomething/followers","following_url":"https://api.github.com/users/DoSomething/following{/other_user}","gists_url":"https://api.github.com/users/DoSomething/gists{/gist_id}","starred_url":"https://api.github.com/users/DoSomething/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DoSomething/subscriptions","organizations_url":"https://api.github.com/users/DoSomething/orgs","repos_url":"https://api.github.com/users/DoSomething/repos","events_url":"https://api.github.com/users/DoSomething/events{/privacy}","received_events_url":"https://api.github.com/users/DoSomething/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/DoSomething/gladiator","description":":guardsman: The DoSomething.org competitions platform.","fork":false,"url":"https://api.github.com/repos/DoSomething/gladiator","forks_url":"https://api.github.com/repos/DoSomething/gladiator/forks","keys_url":"https://api.github.com/repos/DoSomething/gladiator/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DoSomething/gladiator/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DoSomething/gladiator/teams","hooks_url":"https://api.github.com/repos/DoSomething/gladiator/hooks","issue_events_url":"https://api.github.com/repos/DoSomething/gladiator/issues/events{/number}","events_url":"https://api.github.com/repos/DoSomething/gladiator/events","assignees_url":"https://api.github.com/repos/DoSomething/gladiator/assignees{/user}","branches_url":"https://api.github.com/repos/DoSomething/gladiator/branches{/branch}","tags_url":"https://api.github.com/repos/DoSomething/gladiator/tags","blobs_url":"https://api.github.com/repos/DoSomething/gladiator/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DoSomething/gladiator/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DoSomething/gladiator/git/refs{/sha}","trees_url":"https://api.github.com/repos/DoSomething/gladiator/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DoSomething/gladiator/statuses/{sha}","languages_url":"https://api.github.com/repos/DoSomething/gladiator/languages","stargazers_url":"https://api.github.com/repos/DoSomething/gladiator/stargazers","contributors_url":"https://api.github.com/repos/DoSomething/gladiator/contributors","subscribers_url":"https://api.github.com/repos/DoSomething/gladiator/subscribers","subscription_url":"https://api.github.com/repos/DoSomething/gladiator/subscription","commits_url":"https://api.github.com/repos/DoSomething/gladiator/commits{/sha}","git_commits_url":"https://api.github.com/repos/DoSomething/gladiator/git/commits{/sha}","comments_url":"https://api.github.com/repos/DoSomething/gladiator/comments{/number}","issue_comment_url":"https://api.github.com/repos/DoSomething/gladiator/issues/comments{/number}","contents_url":"https://api.github.com/repos/DoSomething/gladiator/contents/{+path}","compare_url":"https://api.github.com/repos/DoSomething/gladiator/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DoSomething/gladiator/merges","archive_url":"https://api.github.com/repos/DoSomething/gladiator/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DoSomething/gladiator/downloads","issues_url":"https://api.github.com/repos/DoSomething/gladiator/issues{/number}","pulls_url":"https://api.github.com/repos/DoSomething/gladiator/pulls{/number}","milestones_url":"https://api.github.com/repos/DoSomething/gladiator/milestones{/number}","notifications_url":"https://api.github.com/repos/DoSomething/gladiator/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DoSomething/gladiator/labels{/name}","releases_url":"https://api.github.com/repos/DoSomething/gladiator/releases{/id}","deployments_url":"https://api.github.com/repos/DoSomething/gladiator/deployments","created_at":"2016-02-05T21:53:32Z","updated_at":"2016-07-07T14:09:38Z","pushed_at":"2016-11-04T16:45:37Z","git_url":"git://github.com/DoSomething/gladiator.git","ssh_url":"git@github.com:DoSomething/gladiator.git","clone_url":"https://github.com/DoSomething/gladiator.git","svn_url":"https://github.com/DoSomething/gladiator","homepage":"","size":856,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":21,"forks":0,"open_issues":21,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/DoSomething/gladiator/pulls/350"},"html":{"href":"https://github.com/DoSomething/gladiator/pull/350"},"issue":{"href":"https://api.github.com/repos/DoSomething/gladiator/issues/350"},"comments":{"href":"https://api.github.com/repos/DoSomething/gladiator/issues/350/comments"},"review_comments":{"href":"https://api.github.com/repos/DoSomething/gladiator/pulls/350/comments"},"review_comment":{"href":"https://api.github.com/repos/DoSomething/gladiator/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/DoSomething/gladiator/pulls/350/commits"},"statuses":{"href":"https://api.github.com/repos/DoSomething/gladiator/statuses/fe220e2fdc21fba72e9eda1b7e913053e4119545"}}}}
{"actor":{"display_login":"sbsmith86"}}