From 2f80c3fd7a29aea63fc9871aa1842c40910be461 Mon Sep 17 00:00:00 2001 From: eemaanamir Date: Tue, 21 Nov 2023 15:16:52 +0500 Subject: [PATCH] fix: exclude anonymous posts in build_course_stats --- models/user.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/user.rb b/models/user.rb index 455a3e0a6d..bf32d7ee2b 100644 --- a/models/user.rb +++ b/models/user.rb @@ -273,7 +273,7 @@ def build_course_stats(course_id) data = Content.collection.aggregate( [ # Match all content in the course by the specified author - { "$match" => { :course_id => course_id, :author_id => self.external_id } }, + { "$match" => { :course_id => course_id, :author_id => self.external_id, "anonymous_to_peers" => false, "anonymous" => false } }, # Keep a count of flags for each entry { "$addFields" => {