From b87712d085b7049413920d01a2b067123006855a Mon Sep 17 00:00:00 2001 From: Aadesh-Baral Date: Thu, 20 Jul 2023 21:25:33 +0545 Subject: [PATCH] Add validated localized features on total localized feature stats --- backend/services/stats_service.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/backend/services/stats_service.py b/backend/services/stats_service.py index 83a7f76..895d327 100644 --- a/backend/services/stats_service.py +++ b/backend/services/stats_service.py @@ -1,4 +1,5 @@ from cachetools import cached, TTLCache +from sqlalchemy import or_, and_ from backend.services.user_service import UserService from backend.models.sql.enum import FeatureStatus @@ -13,8 +14,14 @@ class StatsService: def get_home_page_stats(): """Get home page stats""" total_challenges = Challenge.query.count() - total_localized = Feature.query.filter_by( - status=FeatureStatus.LOCALIZED.value + total_localized = Feature.query.filter( + or_( + and_( + Feature.status == FeatureStatus.VALIDATED.value, + Feature.last_status == FeatureStatus.LOCALIZED.value, + ), + Feature.status == FeatureStatus.LOCALIZED.value, + ) ).count() total_users = User.query.count() return HomeStatsDTO(