From e014c94446c6bd94039e967c10e73190e17d3237 Mon Sep 17 00:00:00 2001 From: Anand Chitipothu Date: Wed, 1 Dec 2021 12:19:03 +0530 Subject: [PATCH] fix: mentor counts on cohort page The group by clause was missing in the query. Issue #271 --- school/lms/doctype/cohort/cohort.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/school/lms/doctype/cohort/cohort.py b/school/lms/doctype/cohort/cohort.py index 1a7a3025..6dbec93d 100644 --- a/school/lms/doctype/cohort/cohort.py +++ b/school/lms/doctype/cohort/cohort.py @@ -27,7 +27,8 @@ class Cohort(Document): q = f""" SELECT subgroup, count(*) as count FROM `tab{doctype}` - WHERE cohort = %(cohort)s""" + WHERE cohort = %(cohort)s + GROUP BY subgroup""" rows = frappe.db.sql(q, values={"cohort": self.name}) return {subgroup: count for subgroup, count in rows}