Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP Refatora estatísticas covid19 para usar queryset #399

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

turicas
Copy link
Owner

@turicas turicas commented Sep 9, 2020

No description provided.

Copy link
Collaborator

@berinhard berinhard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Até agora tá bom! Gostei demais de ter separado a classe Covid19Stats em implementações específicas por tabela. Esse caminho me parace bem coerente em como o resto do Brasil.io está estruturado!

core/models.py Outdated Show resolved Hide resolved
covid19/newstats.py Show resolved Hide resolved
Comment on lines +58 to +70
@property
def number_of_cities_with_cases(self):
return self.get_queryset().latest_city_cases().count()

@property
def number_of_cities_with_deaths(self):
return self.get_queryset().latest_city_cases().with_deaths().count()

@property
def affected_population(self):
return (
self.get_queryset().latest_city_cases().aggregate(population=Sum("estimated_population_2019"))["population"]
)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Acho que vale a pena adicionarmos testes para essas métricas, não? Sei que esse não é o foco do trabalho agora, mas assim como fizemos com os dynamic models com issue #396, me parece que aqui também vale uma issue lembrete dos testes uma hora que tenhamos esse PR mergeado

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants