-
-
Notifications
You must be signed in to change notification settings - Fork 144
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
base: develop
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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!
@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"] | ||
) |
There was a problem hiding this comment.
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
f40c0f8
to
503900c
Compare
No description provided.