Skip to content

Commit

Permalink
Add validated localized features on total localized feature stats
Browse files Browse the repository at this point in the history
  • Loading branch information
Aadesh-Baral committed Jul 21, 2023
1 parent e718dd3 commit b87712d
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions backend/services/stats_service.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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(
Expand Down

0 comments on commit b87712d

Please sign in to comment.