LinkinStars commented on code in PR #668:
URL: https://github.com/apache/incubator-answer/pull/668#discussion_r1413311680


##########
internal/controller/answer_controller.go:
##########
@@ -238,6 +242,23 @@ func (ac *AnswerController) Add(ctx *gin.Context) {
                return
        }
 
+       write, err := ac.siteInfoCommonService.GetSiteWrite(ctx)
+       if err != nil {
+               handler.HandleResponse(ctx, err, nil)
+       }

Review Comment:
   Missing the `return`.



##########
internal/service/answer_common/answer.go:
##########


Review Comment:
   My suggestion is that it would be better to replace this method directly.
   
   `GetByUserIDQuestionID(ctx context.Context, userID string, questionID 
string) ([]*entity.Answer, error)`
   
   Replace with
   
   `GetAnswerCount(ctx context.Context, userID string, questionID string) 
(answerCount int64, err error)`
   
   Reason:
   1. `GetByUserIDQuestionID` function everywhere used do not need answer 
details.
   2. Only counting  the number maybe a faster query than returning all the 
contents of the answer. (Some answers might have a lot of content.)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to