Fix post count for older threads with lazy deleted forum posts

This commit is contained in:
Andreas Svanberg 2025-04-08 14:40:33 +02:00
parent 2983e13af6
commit 23295d3875

@ -15,6 +15,7 @@ import jakarta.persistence.Table;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.function.Predicate;
import se.su.dsv.scipro.system.LazyDeletableDomainObject;
import se.su.dsv.scipro.system.User;
@ -100,8 +101,8 @@ public class ForumThread extends LazyDeletableDomainObject {
posts.add(post);
}
public int getPostCount() {
return posts.size();
public long getPostCount() {
return posts.stream().filter(Predicate.not(ForumPost::isDeleted)).count();
}
public User getCreatedBy() {