From 574cb3e12458768cb710083979be773ae4d78a42 Mon Sep 17 00:00:00 2001 From: Khoa Nguyen Date: Wed, 5 Aug 2020 12:21:03 +0700 Subject: [PATCH] GWZ-217: Update review time in PullRequest Information with minutes unit --- src/controller/pullrequest.go | 4 ++-- src/controller/pullrequest_test.go | 18 +++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/controller/pullrequest.go b/src/controller/pullrequest.go index 95533e6..f0cf80b 100644 --- a/src/controller/pullrequest.go +++ b/src/controller/pullrequest.go @@ -83,7 +83,7 @@ func getPullRequestSize(c *gin.Context) { Title: pullRequest.Title, Size: pullRequest.Addition + pullRequest.Deletion, Status: pullRequest.Status, - ReviewTime: pullRequest.ReviewDuration / 3600, + ReviewTime: pullRequest.ReviewDuration / 60, Url: pullRequest.Url, CreatedDate: createdDate.Format(commonDateFormat), CreatedBy: pullRequest.CreatedBy, @@ -99,7 +99,7 @@ func getPullRequestSize(c *gin.Context) { Title: pullRequest.Title, Size: pullRequest.Addition + pullRequest.Deletion, Status: "opened", - ReviewTime: pullRequest.ReviewDuration / 3600, + ReviewTime: pullRequest.ReviewDuration / 60, Url: pullRequest.Url, CreatedDate: createdDate.Format(commonDateFormat), CreatedBy: pullRequest.CreatedBy, diff --git a/src/controller/pullrequest_test.go b/src/controller/pullrequest_test.go index a98850a..372f1b2 100644 --- a/src/controller/pullrequest_test.go +++ b/src/controller/pullrequest_test.go @@ -23,15 +23,15 @@ func Test_PullRequestSize_OK(t *testing.T) { expected := "{" + "\"2020-05-05\":[]," + "\"2020-05-06\":[]," + - "\"2020-05-07\":[{\"title\":\"GWZ-23 verifies access token\",\"size\":120,\"status\":\"opened\",\"review_time\":89," + + "\"2020-05-07\":[{\"title\":\"GWZ-23 verifies access token\",\"size\":120,\"status\":\"opened\",\"review_time\":5379," + "\"url\":\"https://github.com/wizeline/gitwize-be/pull/1\",\"created_date\":\"2020-05-07\",\"created_by\":\"ltvcuong\"}]," + - "\"2020-05-08\":[{\"title\":\"GWZ-23 verifies access token\",\"size\":120,\"status\":\"opened\",\"review_time\":89," + + "\"2020-05-08\":[{\"title\":\"GWZ-23 verifies access token\",\"size\":120,\"status\":\"opened\",\"review_time\":5379," + "\"url\":\"https://github.com/wizeline/gitwize-be/pull/1\",\"created_date\":\"2020-05-07\",\"created_by\":\"ltvcuong\"}]," + - "\"2020-05-09\":[{\"title\":\"GWZ-23 verifies access token\",\"size\":120,\"status\":\"opened\",\"review_time\":89," + + "\"2020-05-09\":[{\"title\":\"GWZ-23 verifies access token\",\"size\":120,\"status\":\"opened\",\"review_time\":5379," + "\"url\":\"https://github.com/wizeline/gitwize-be/pull/1\",\"created_date\":\"2020-05-07\",\"created_by\":\"ltvcuong\"}]," + - "\"2020-05-10\":[{\"title\":\"GWZ-23 verifies access token\",\"size\":120,\"status\":\"opened\",\"review_time\":89," + + "\"2020-05-10\":[{\"title\":\"GWZ-23 verifies access token\",\"size\":120,\"status\":\"opened\",\"review_time\":5379," + "\"url\":\"https://github.com/wizeline/gitwize-be/pull/1\",\"created_date\":\"2020-05-07\",\"created_by\":\"ltvcuong\"}]," + - "\"2020-05-11\":[{\"title\":\"GWZ-23 verifies access token\",\"size\":120,\"status\":\"merged\",\"review_time\":89," + + "\"2020-05-11\":[{\"title\":\"GWZ-23 verifies access token\",\"size\":120,\"status\":\"merged\",\"review_time\":5379," + "\"url\":\"https://github.com/wizeline/gitwize-be/pull/1\",\"created_date\":\"2020-05-07\",\"created_by\":\"ltvcuong\"}]," + "\"2020-05-12\":[]}" assert.Equal(t, expected, w.Body.String()) @@ -45,13 +45,13 @@ func Test_PullRequestSize_OK(t *testing.T) { expected = "{" + "\"2020-05-05\":[]," + "\"2020-05-06\":[]," + - "\"2020-05-07\":[{\"title\":\"GWZ-23 verifies access token\",\"size\":120,\"status\":\"opened\",\"review_time\":89," + + "\"2020-05-07\":[{\"title\":\"GWZ-23 verifies access token\",\"size\":120,\"status\":\"opened\",\"review_time\":5379," + "\"url\":\"https://github.com/wizeline/gitwize-be/pull/1\",\"created_date\":\"2020-05-07\",\"created_by\":\"ltvcuong\"}]," + - "\"2020-05-08\":[{\"title\":\"GWZ-23 verifies access token\",\"size\":120,\"status\":\"opened\",\"review_time\":89," + + "\"2020-05-08\":[{\"title\":\"GWZ-23 verifies access token\",\"size\":120,\"status\":\"opened\",\"review_time\":5379," + "\"url\":\"https://github.com/wizeline/gitwize-be/pull/1\",\"created_date\":\"2020-05-07\",\"created_by\":\"ltvcuong\"}]," + - "\"2020-05-09\":[{\"title\":\"GWZ-23 verifies access token\",\"size\":120,\"status\":\"opened\",\"review_time\":89," + + "\"2020-05-09\":[{\"title\":\"GWZ-23 verifies access token\",\"size\":120,\"status\":\"opened\",\"review_time\":5379," + "\"url\":\"https://github.com/wizeline/gitwize-be/pull/1\",\"created_date\":\"2020-05-07\",\"created_by\":\"ltvcuong\"}]," + - "\"2020-05-10\":[{\"title\":\"GWZ-23 verifies access token\",\"size\":120,\"status\":\"opened\",\"review_time\":89," + + "\"2020-05-10\":[{\"title\":\"GWZ-23 verifies access token\",\"size\":120,\"status\":\"opened\",\"review_time\":5379," + "\"url\":\"https://github.com/wizeline/gitwize-be/pull/1\",\"created_date\":\"2020-05-07\",\"created_by\":\"ltvcuong\"}]}" assert.Equal(t, expected, w.Body.String()) }