A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.
fix: set last answer ID to zero if no answers
Sonui2167a8243c56
diff --git a/internal/service/question_common/question.go b/internal/service/question_common/question.goindex fce3761e..b9f2fd53 100644--- a/internal/service/question_common/question.go+++ b/internal/service/question_common/question.go@@ -145,6 +145,15 @@ func (qs *QuestionCommon) UpdateAnswerCount(ctx context.Context, questionID striif err != nil {return err}+ if count == 0 {+ err = qs.questionRepo.UpdateLastAnswer(ctx, &entity.Question{+ ID: questionID,+ LastAnswerID: "0",+ })+ if err != nil {+ return err+ }+ }return qs.questionRepo.UpdateAnswerCount(ctx, questionID, int(count))}