fix post stats being a cartesian product
This commit is contained in:
		@@ -38,7 +38,7 @@ class Users(Model):
 | 
			
		||||
 | 
			
		||||
    def get_post_stats(self):
 | 
			
		||||
        q = """SELECT
 | 
			
		||||
                COUNT(posts.id) AS post_count,
 | 
			
		||||
                COUNT(DISTINCT posts.id) AS post_count,
 | 
			
		||||
                COUNT(DISTINCT threads.id) AS thread_count,
 | 
			
		||||
                MAX(threads.title) FILTER (WHERE threads.created_at = latest.created_at) AS latest_thread_title,
 | 
			
		||||
                MAX(threads.slug) FILTER (WHERE threads.created_at = latest.created_at) AS latest_thread_slug
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user