{"action":"created","comment":{"url":"https://api.github.com/repos/hmrc/fset-faststream/pulls/comments/84479176","pull_request_review_id":5256367,"id":84479176,"diff_hunk":"@@ -97,11 +91,32 @@ trait OnlineTestController extends BaseController {\n   def resetOnlineTests(appId: String) = Action.async(parse.json) { implicit request =>\n     withJsonBody[ResetOnlineTest] { resetOnlineTest =>\n       appRepository.getOnlineTestApplication(appId).flatMap {\n-        case Some(onlineTestApp) => onlineTestingService.resetTests(onlineTestApp, resetOnlineTest.tests,\n+        case Some(onlineTestApp) => phase1TestService.resetTests(onlineTestApp, resetOnlineTest.tests,\n           resetOnlineTest.actionTriggeredBy).map ( _ => Ok )\n         case _ => Future.successful(NotFound)\n       }\n     }\n+  }\n+\n+  def resetPhase2OnlineTest(appId: String) = Action.async(parse.json) { implicit request =>\n+    withJsonBody[ResetPhase2Test] { resetPhase2Test =>\n+\n+      def reset(onlineTestApp: OnlineTestApplication, actionTriggeredBy: String) =\n+        phase2TestService.resetTests(onlineTestApp, actionTriggeredBy)\n+          .map { _ =>\n+            Ok(Json.toJson(ResetPhase2TestStatus(success = true)))\n+          }\n+          .recover {\n+            case _: ResetLimitExceededException =>\n+              Ok(Json.toJson(ResetPhase2TestStatus(success = false, resetLimitExceeded = true)))\n+            case _: CannotResetPhase2Tests =>\n+              Ok(Json.toJson(ResetPhase2TestStatus(success = false)))","path":"app/controllers/OnlineTestController.scala","position":77,"original_position":77,"commit_id":"cd96faf5d379b41d3d6279a10bf382da7695329a","original_commit_id":"cd96faf5d379b41d3d6279a10bf382da7695329a","user":{"login":"ollyw","id":632442,"avatar_url":"https://avatars.githubusercontent.com/u/632442?v=3","gravatar_id":"","url":"https://api.github.com/users/ollyw","html_url":"https://github.com/ollyw","followers_url":"https://api.github.com/users/ollyw/followers","following_url":"https://api.github.com/users/ollyw/following{/other_user}","gists_url":"https://api.github.com/users/ollyw/gists{/gist_id}","starred_url":"https://api.github.com/users/ollyw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ollyw/subscriptions","organizations_url":"https://api.github.com/users/ollyw/orgs","repos_url":"https://api.github.com/users/ollyw/repos","events_url":"https://api.github.com/users/ollyw/events{/privacy}","received_events_url":"https://api.github.com/users/ollyw/received_events","type":"User","site_admin":false},"body":"Perhaps this should be a 404, given that the CannotResetPhase2Tests exception inherits from NotFound. Certainly returning a 200 is not very 'RESTFul'. I would argue that ResetLimitExceededException could be HTTP code 424 and CannotResetPhase2Tests a 404. That way you don't need to return a success flag. What do you think?","created_at":"2016-10-21T13:33:50Z","updated_at":"2016-10-21T13:33:50Z","html_url":"https://github.com/hmrc/fset-faststream/pull/138#discussion_r84479176","pull_request_url":"https://api.github.com/repos/hmrc/fset-faststream/pulls/138","_links":{"self":{"href":"https://api.github.com/repos/hmrc/fset-faststream/pulls/comments/84479176"},"html":{"href":"https://github.com/hmrc/fset-faststream/pull/138#discussion_r84479176"},"pull_request":{"href":"https://api.github.com/repos/hmrc/fset-faststream/pulls/138"}}},"pull_request":{"url":"https://api.github.com/repos/hmrc/fset-faststream/pulls/138","id":90236138,"html_url":"https://github.com/hmrc/fset-faststream/pull/138","diff_url":"https://github.com/hmrc/fset-faststream/pull/138.diff","patch_url":"https://github.com/hmrc/fset-faststream/pull/138.patch","issue_url":"https://api.github.com/repos/hmrc/fset-faststream/issues/138","number":138,"state":"open","locked":false,"title":"FSET-686: Reset etray","user":{"login":"satishkamatam","id":11999766,"avatar_url":"https://avatars.githubusercontent.com/u/11999766?v=3","gravatar_id":"","url":"https://api.github.com/users/satishkamatam","html_url":"https://github.com/satishkamatam","followers_url":"https://api.github.com/users/satishkamatam/followers","following_url":"https://api.github.com/users/satishkamatam/following{/other_user}","gists_url":"https://api.github.com/users/satishkamatam/gists{/gist_id}","starred_url":"https://api.github.com/users/satishkamatam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/satishkamatam/subscriptions","organizations_url":"https://api.github.com/users/satishkamatam/orgs","repos_url":"https://api.github.com/users/satishkamatam/repos","events_url":"https://api.github.com/users/satishkamatam/events{/privacy}","received_events_url":"https://api.github.com/users/satishkamatam/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-10-20T16:31:29Z","updated_at":"2016-10-21T13:33:50Z","closed_at":null,"merged_at":null,"merge_commit_sha":"eae574a384d7f1e044038ceaac939b0a1208e12c","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/hmrc/fset-faststream/pulls/138/commits","review_comments_url":"https://api.github.com/repos/hmrc/fset-faststream/pulls/138/comments","review_comment_url":"https://api.github.com/repos/hmrc/fset-faststream/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hmrc/fset-faststream/issues/138/comments","statuses_url":"https://api.github.com/repos/hmrc/fset-faststream/statuses/cd96faf5d379b41d3d6279a10bf382da7695329a","head":{"label":"hmrc:fset-686","ref":"fset-686","sha":"cd96faf5d379b41d3d6279a10bf382da7695329a","user":{"login":"hmrc","id":5755339,"avatar_url":"https://avatars.githubusercontent.com/u/5755339?v=3","gravatar_id":"","url":"https://api.github.com/users/hmrc","html_url":"https://github.com/hmrc","followers_url":"https://api.github.com/users/hmrc/followers","following_url":"https://api.github.com/users/hmrc/following{/other_user}","gists_url":"https://api.github.com/users/hmrc/gists{/gist_id}","starred_url":"https://api.github.com/users/hmrc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hmrc/subscriptions","organizations_url":"https://api.github.com/users/hmrc/orgs","repos_url":"https://api.github.com/users/hmrc/repos","events_url":"https://api.github.com/users/hmrc/events{/privacy}","received_events_url":"https://api.github.com/users/hmrc/received_events","type":"Organization","site_admin":false},"repo":{"id":62889113,"name":"fset-faststream","full_name":"hmrc/fset-faststream","owner":{"login":"hmrc","id":5755339,"avatar_url":"https://avatars.githubusercontent.com/u/5755339?v=3","gravatar_id":"","url":"https://api.github.com/users/hmrc","html_url":"https://github.com/hmrc","followers_url":"https://api.github.com/users/hmrc/followers","following_url":"https://api.github.com/users/hmrc/following{/other_user}","gists_url":"https://api.github.com/users/hmrc/gists{/gist_id}","starred_url":"https://api.github.com/users/hmrc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hmrc/subscriptions","organizations_url":"https://api.github.com/users/hmrc/orgs","repos_url":"https://api.github.com/users/hmrc/repos","events_url":"https://api.github.com/users/hmrc/events{/privacy}","received_events_url":"https://api.github.com/users/hmrc/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hmrc/fset-faststream","description":null,"fork":false,"url":"https://api.github.com/repos/hmrc/fset-faststream","forks_url":"https://api.github.com/repos/hmrc/fset-faststream/forks","keys_url":"https://api.github.com/repos/hmrc/fset-faststream/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hmrc/fset-faststream/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hmrc/fset-faststream/teams","hooks_url":"https://api.github.com/repos/hmrc/fset-faststream/hooks","issue_events_url":"https://api.github.com/repos/hmrc/fset-faststream/issues/events{/number}","events_url":"https://api.github.com/repos/hmrc/fset-faststream/events","assignees_url":"https://api.github.com/repos/hmrc/fset-faststream/assignees{/user}","branches_url":"https://api.github.com/repos/hmrc/fset-faststream/branches{/branch}","tags_url":"https://api.github.com/repos/hmrc/fset-faststream/tags","blobs_url":"https://api.github.com/repos/hmrc/fset-faststream/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hmrc/fset-faststream/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hmrc/fset-faststream/git/refs{/sha}","trees_url":"https://api.github.com/repos/hmrc/fset-faststream/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hmrc/fset-faststream/statuses/{sha}","languages_url":"https://api.github.com/repos/hmrc/fset-faststream/languages","stargazers_url":"https://api.github.com/repos/hmrc/fset-faststream/stargazers","contributors_url":"https://api.github.com/repos/hmrc/fset-faststream/contributors","subscribers_url":"https://api.github.com/repos/hmrc/fset-faststream/subscribers","subscription_url":"https://api.github.com/repos/hmrc/fset-faststream/subscription","commits_url":"https://api.github.com/repos/hmrc/fset-faststream/commits{/sha}","git_commits_url":"https://api.github.com/repos/hmrc/fset-faststream/git/commits{/sha}","comments_url":"https://api.github.com/repos/hmrc/fset-faststream/comments{/number}","issue_comment_url":"https://api.github.com/repos/hmrc/fset-faststream/issues/comments{/number}","contents_url":"https://api.github.com/repos/hmrc/fset-faststream/contents/{+path}","compare_url":"https://api.github.com/repos/hmrc/fset-faststream/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hmrc/fset-faststream/merges","archive_url":"https://api.github.com/repos/hmrc/fset-faststream/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hmrc/fset-faststream/downloads","issues_url":"https://api.github.com/repos/hmrc/fset-faststream/issues{/number}","pulls_url":"https://api.github.com/repos/hmrc/fset-faststream/pulls{/number}","milestones_url":"https://api.github.com/repos/hmrc/fset-faststream/milestones{/number}","notifications_url":"https://api.github.com/repos/hmrc/fset-faststream/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hmrc/fset-faststream/labels{/name}","releases_url":"https://api.github.com/repos/hmrc/fset-faststream/releases{/id}","deployments_url":"https://api.github.com/repos/hmrc/fset-faststream/deployments","created_at":"2016-07-08T13:03:46Z","updated_at":"2016-07-13T15:13:30Z","pushed_at":"2016-10-21T13:14:48Z","git_url":"git://github.com/hmrc/fset-faststream.git","ssh_url":"git@github.com:hmrc/fset-faststream.git","clone_url":"https://github.com/hmrc/fset-faststream.git","svn_url":"https://github.com/hmrc/fset-faststream","homepage":"","size":2129,"stargazers_count":2,"watchers_count":2,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":7,"forks":0,"open_issues":7,"watchers":2,"default_branch":"master"}},"base":{"label":"hmrc:master","ref":"master","sha":"0d5f280fcef70e7eee9d1250762df5eef4d02028","user":{"login":"hmrc","id":5755339,"avatar_url":"https://avatars.githubusercontent.com/u/5755339?v=3","gravatar_id":"","url":"https://api.github.com/users/hmrc","html_url":"https://github.com/hmrc","followers_url":"https://api.github.com/users/hmrc/followers","following_url":"https://api.github.com/users/hmrc/following{/other_user}","gists_url":"https://api.github.com/users/hmrc/gists{/gist_id}","starred_url":"https://api.github.com/users/hmrc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hmrc/subscriptions","organizations_url":"https://api.github.com/users/hmrc/orgs","repos_url":"https://api.github.com/users/hmrc/repos","events_url":"https://api.github.com/users/hmrc/events{/privacy}","received_events_url":"https://api.github.com/users/hmrc/received_events","type":"Organization","site_admin":false},"repo":{"id":62889113,"name":"fset-faststream","full_name":"hmrc/fset-faststream","owner":{"login":"hmrc","id":5755339,"avatar_url":"https://avatars.githubusercontent.com/u/5755339?v=3","gravatar_id":"","url":"https://api.github.com/users/hmrc","html_url":"https://github.com/hmrc","followers_url":"https://api.github.com/users/hmrc/followers","following_url":"https://api.github.com/users/hmrc/following{/other_user}","gists_url":"https://api.github.com/users/hmrc/gists{/gist_id}","starred_url":"https://api.github.com/users/hmrc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hmrc/subscriptions","organizations_url":"https://api.github.com/users/hmrc/orgs","repos_url":"https://api.github.com/users/hmrc/repos","events_url":"https://api.github.com/users/hmrc/events{/privacy}","received_events_url":"https://api.github.com/users/hmrc/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hmrc/fset-faststream","description":null,"fork":false,"url":"https://api.github.com/repos/hmrc/fset-faststream","forks_url":"https://api.github.com/repos/hmrc/fset-faststream/forks","keys_url":"https://api.github.com/repos/hmrc/fset-faststream/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hmrc/fset-faststream/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hmrc/fset-faststream/teams","hooks_url":"https://api.github.com/repos/hmrc/fset-faststream/hooks","issue_events_url":"https://api.github.com/repos/hmrc/fset-faststream/issues/events{/number}","events_url":"https://api.github.com/repos/hmrc/fset-faststream/events","assignees_url":"https://api.github.com/repos/hmrc/fset-faststream/assignees{/user}","branches_url":"https://api.github.com/repos/hmrc/fset-faststream/branches{/branch}","tags_url":"https://api.github.com/repos/hmrc/fset-faststream/tags","blobs_url":"https://api.github.com/repos/hmrc/fset-faststream/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hmrc/fset-faststream/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hmrc/fset-faststream/git/refs{/sha}","trees_url":"https://api.github.com/repos/hmrc/fset-faststream/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hmrc/fset-faststream/statuses/{sha}","languages_url":"https://api.github.com/repos/hmrc/fset-faststream/languages","stargazers_url":"https://api.github.com/repos/hmrc/fset-faststream/stargazers","contributors_url":"https://api.github.com/repos/hmrc/fset-faststream/contributors","subscribers_url":"https://api.github.com/repos/hmrc/fset-faststream/subscribers","subscription_url":"https://api.github.com/repos/hmrc/fset-faststream/subscription","commits_url":"https://api.github.com/repos/hmrc/fset-faststream/commits{/sha}","git_commits_url":"https://api.github.com/repos/hmrc/fset-faststream/git/commits{/sha}","comments_url":"https://api.github.com/repos/hmrc/fset-faststream/comments{/number}","issue_comment_url":"https://api.github.com/repos/hmrc/fset-faststream/issues/comments{/number}","contents_url":"https://api.github.com/repos/hmrc/fset-faststream/contents/{+path}","compare_url":"https://api.github.com/repos/hmrc/fset-faststream/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hmrc/fset-faststream/merges","archive_url":"https://api.github.com/repos/hmrc/fset-faststream/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hmrc/fset-faststream/downloads","issues_url":"https://api.github.com/repos/hmrc/fset-faststream/issues{/number}","pulls_url":"https://api.github.com/repos/hmrc/fset-faststream/pulls{/number}","milestones_url":"https://api.github.com/repos/hmrc/fset-faststream/milestones{/number}","notifications_url":"https://api.github.com/repos/hmrc/fset-faststream/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hmrc/fset-faststream/labels{/name}","releases_url":"https://api.github.com/repos/hmrc/fset-faststream/releases{/id}","deployments_url":"https://api.github.com/repos/hmrc/fset-faststream/deployments","created_at":"2016-07-08T13:03:46Z","updated_at":"2016-07-13T15:13:30Z","pushed_at":"2016-10-21T13:14:48Z","git_url":"git://github.com/hmrc/fset-faststream.git","ssh_url":"git@github.com:hmrc/fset-faststream.git","clone_url":"https://github.com/hmrc/fset-faststream.git","svn_url":"https://github.com/hmrc/fset-faststream","homepage":"","size":2129,"stargazers_count":2,"watchers_count":2,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":7,"forks":0,"open_issues":7,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hmrc/fset-faststream/pulls/138"},"html":{"href":"https://github.com/hmrc/fset-faststream/pull/138"},"issue":{"href":"https://api.github.com/repos/hmrc/fset-faststream/issues/138"},"comments":{"href":"https://api.github.com/repos/hmrc/fset-faststream/issues/138/comments"},"review_comments":{"href":"https://api.github.com/repos/hmrc/fset-faststream/pulls/138/comments"},"review_comment":{"href":"https://api.github.com/repos/hmrc/fset-faststream/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hmrc/fset-faststream/pulls/138/commits"},"statuses":{"href":"https://api.github.com/repos/hmrc/fset-faststream/statuses/cd96faf5d379b41d3d6279a10bf382da7695329a"}}}}
{"actor":{"display_login":"ollyw"}}