-
Notifications
You must be signed in to change notification settings - Fork 37
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
(PC-33135)[BO] feat: use Clickhouse for statistics in BO #15153
Conversation
clickhouse_result = clickhouse_queries.YearlyAggregatedRevenueQuery().execute( | ||
tuple(venue.id for venue in offerer.managedVenues) | ||
) | ||
details: dict[str, dict] = {} | ||
future = {"individual": decimal.Decimal(0.0), "collective": decimal.Decimal(0.0)} | ||
for year, yearly_data in clickhouse_result.income_by_year.items(): | ||
details[year] = { | ||
"individual": yearly_data.revenue.individual, # type: ignore[union-attr] | ||
"collective": yearly_data.revenue.collective, # type: ignore[union-attr] | ||
} | ||
future["individual"] += yearly_data.expected_revenue.individual - yearly_data.revenue.individual # type: ignore[union-attr] | ||
future["collective"] += yearly_data.expected_revenue.collective - yearly_data.revenue.collective # type: ignore[union-attr] | ||
if sum(future.values()) > 0: | ||
details["En cours"] = future |
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.
En fait ça pourrait même valoir le coup de demander à ce qu'il y ait une colonne qui contienne ce calcul directement dans clickhouse
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.
(je parlais du future
j'ai eu la main leste sur la longueur du code à commenter)
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.
L'idée me semble bonne, on modifiera le code si la table évolue.
ff2502d
to
36e0593
Compare
But de la pull request
Ticket Jira : https://passculture.atlassian.net/browse/PC-33135
Vérifications