Skip to content

Commit

Permalink
fixed converting answer to comment doesn't update answercount on pare…
Browse files Browse the repository at this point in the history
…nt question, closes Erudika/scoold-pro#68
  • Loading branch information
albogdano committed Aug 1, 2024
1 parent 11c301d commit ade066c
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ public String get(@PathVariable String id, @PathVariable(required = false) Strin
Pager itemcount = utils.getPager("page", req);
itemcount.setSortby("newest".equals(sortby) ? "timestamp" : "votes");
List<Reply> answerslist = getAllAnswers(authUser, showPost, itemcount, req);
showPost.setAnswercount(itemcount.getCount()); // autocorrect answer count
LinkedList<Post> allPosts = new LinkedList<Post>();
allPosts.add(showPost);
allPosts.addAll(answerslist);
Expand Down Expand Up @@ -374,6 +375,7 @@ public String makeComment(@PathVariable String id, @PathVariable String answerid
c = pc.create(c);
if (c != null) {
question.addCommentId(c.getId());
question.setAnswercount(question.getAnswercount() - 1);
pc.update(question);
answer.delete();
return "redirect:" + question.getPostLinkForRedirect();
Expand Down

0 comments on commit ade066c

Please sign in to comment.