From 0f2a6a8ccc3dc6fafe042f9a6c653a9530d8ca6a Mon Sep 17 00:00:00 2001 From: Adhityaa Date: Thu, 7 Jun 2018 13:09:53 +0530 Subject: [PATCH] api: rename VoteDirection to Direction --- api/comment.go | 2 +- api/comment_list.go | 4 ++-- api/comment_list_test.go | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/api/comment.go b/api/comment.go index d7f4050..b1a23b0 100644 --- a/api/comment.go +++ b/api/comment.go @@ -15,5 +15,5 @@ type comment struct { Score int `json:"score"` State string `json:"state"` CreationDate time.Time `json:"creationDate"` - VoteDirection int `json:"voteDirection"` + Direction int `json:"direction"` } diff --git a/api/comment_list.go b/api/comment_list.go index 73c19ae..1f1ed3f 100644 --- a/api/comment_list.go +++ b/api/comment_list.go @@ -65,9 +65,9 @@ func commentList(commenterHex string, domain string, path string, includeUnappro ` row := db.QueryRow(statement, c.CommentHex, commenterHex) - if err = row.Scan(&c.VoteDirection); err != nil { + if err = row.Scan(&c.Direction); err != nil { // TODO: is the only error here that there is no such entry? - c.VoteDirection = 0 + c.Direction = 0 } } diff --git a/api/comment_list_test.go b/api/comment_list_test.go index e3ca0f1..2ab83c0 100644 --- a/api/comment_list_test.go +++ b/api/comment_list_test.go @@ -25,8 +25,8 @@ func TestCommentListBasics(t *testing.T) { return } - if c[0].VoteDirection != 0 { - t.Errorf("expected c.VoteDirection = 0 got c.VoteDirection = %d", c[0].VoteDirection) + if c[0].Direction != 0 { + t.Errorf("expected c.Direction = 0 got c.Direction = %d", c[0].Direction) return } @@ -47,8 +47,8 @@ func TestCommentListBasics(t *testing.T) { return } - if c[0].VoteDirection != 1 { - t.Errorf("expected c.VoteDirection = 1 got c.VoteDirection = %d", c[0].VoteDirection) + if c[0].Direction != 1 { + t.Errorf("expected c.Direction = 1 got c.Direction = %d", c[0].Direction) return } }