From 1056208ad3d5c77be32954988d1f53c9026e13b8 Mon Sep 17 00:00:00 2001 From: Emanuel Cino Date: Tue, 21 Feb 2023 13:15:01 +0100 Subject: [PATCH] CP-256 FIX homepage barometers --- .../controllers/homepage_controller.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/crowdfunding_compassion/controllers/homepage_controller.py b/crowdfunding_compassion/controllers/homepage_controller.py index f9d64f5dc..611fa1c01 100644 --- a/crowdfunding_compassion/controllers/homepage_controller.py +++ b/crowdfunding_compassion/controllers/homepage_controller.py @@ -64,24 +64,20 @@ def _compute_homepage_context(): ) if fund.image_large else SPONSOR_HEADER, }) - # populate the fund information depending of the impact type and the number of impact + # populate the fund information depending on the impact type and the number of impact impact = { "sponsorship": sponsorship_card_content() } for fund in request.env['product.product'].sudo().search( - [('product_tmpl_id.show_fund_together_homepage', '=', True)]): + [('product_tmpl_id.show_fund_together_homepage', '=', True)], order="total_fund_impact DESC"): impact_val = fund.product_tmpl_id.total_fund_impact - large_impact = fund.impact_type == "large" - if large_impact and impact_val > 100: - fund_text = fund.crowdfunding_impact_text_passive_plural - impact_val = int(impact_val / 100) - elif not large_impact and impact_val > 1: + if impact_val > 1: fund_text = fund.crowdfunding_impact_text_passive_plural else: fund_text = fund.crowdfunding_impact_text_passive_singular impact[fund.name] = { "type": "fund", - "value": impact_val, + "value": f"{impact_val:,}", "text": fund_text, "description": fund.crowdfunding_description, "icon_image": fund.image_medium or SPONSOR_ICON,