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

(PC-33135)[BO] feat: use Clickhouse for statistics in BO #15153

Merged
merged 1 commit into from
Nov 22, 2024

Conversation

prouzet-pass
Copy link
Contributor

But de la pull request

Ticket Jira : https://passculture.atlassian.net/browse/PC-33135

Vérifications

  • J'ai écrit les tests nécessaires
  • J'ai mis à jour le fichier des plans de tests du portail pro si nécessaire
  • J'ai mis à jour la liste des routes et des titres de pages du portail pro si j'en ai rajouté/modifié ou supprimé une.
  • J'ai relu attentivement les migrations, en particulier pour éviter les locks, et je préviens les équipes Shérif et Data
  • J'ai ajouté des screenshots pour d'éventuels changements graphiques

Copy link
Contributor

github-actions bot commented Nov 20, 2024

mypy cop report: 458 (master) ↗ 466 (your branch)

Comment on lines +338 to +351
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
Copy link
Contributor

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

Copy link
Contributor

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)

Copy link
Contributor Author

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.

@prouzet-pass prouzet-pass merged commit 975d617 into master Nov 22, 2024
24 checks passed
@prouzet-pass prouzet-pass deleted the pc-33135-bo-clickhouse branch November 22, 2024 15:53
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.

2 participants