diff --git a/backend/src/main/java/mosquitobytes/carboncritters/service/ProductService.java b/backend/src/main/java/mosquitobytes/carboncritters/service/ProductService.java index 3f9185c..03d0356 100644 --- a/backend/src/main/java/mosquitobytes/carboncritters/service/ProductService.java +++ b/backend/src/main/java/mosquitobytes/carboncritters/service/ProductService.java @@ -11,6 +11,7 @@ @Service public class ProductService { + public static final double BASELINE = 200.0; private final ConsumedProductRepository consumedProducts; private final ProfileService profileService; @@ -32,7 +33,9 @@ public void addProduct(Long consumerId, String productCode) { consumedProducts.save(consumedProduct); - profileService.updateScore(consumerId, consumedProduct.product().footprint()); + var footprint = consumedProduct.product().footprint(); + var score = BASELINE - footprint; + profileService.updateScore(consumerId, (int) score); try { webSocketHandler.sendLeaderBoardToAllActiveSessions();