Skip to content

Commit

Permalink
User statistics refactored.
Browse files Browse the repository at this point in the history
  • Loading branch information
prabinoid committed Dec 30, 2024
1 parent 17b14bf commit 33d10db
Show file tree
Hide file tree
Showing 3 changed files with 134 additions and 178 deletions.
2 changes: 1 addition & 1 deletion backend/api/users/statistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ async def get(
description: Internal Server Error
"""
stats_dto = await UserService.get_detailed_stats(username, db)
return stats_dto.model_dump(by_alias=True)
return stats_dto


@router.get("/{user_id}/statistics/interests/")
Expand Down
7 changes: 3 additions & 4 deletions backend/models/dtos/user_dto.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,12 @@ class UserCountryContributed(BaseModel):
class UserCountriesContributed(BaseModel):
"""DTO for countries a user has contributed"""

def __init__(self):
super().__init__()
self.countries_contributed = []

countries_contributed: List[UserCountryContributed] = Field([], alias="countries")
total: int = Field(None)

class Config:
populate_by_name = True


class UserContributionDTO(BaseModel):
date: datetime
Expand Down
Loading

0 comments on commit 33d10db

Please sign in to comment.