Refactor balance sheet weight calculation and improve group weight rendering

- Update BalanceSheet model to directly calculate account weights based on converted balances.
- Modify dashboard view to compute account weight as a percentage of classification total, enhancing clarity.
- Adjust group weight partial to handle effective weight, ensuring accurate rendering of weight representation.
This commit is contained in:
Josh Pigford
2025-05-23 12:25:18 -05:00
parent fd65b5a747
commit 5cfb4addbd
3 changed files with 14 additions and 9 deletions

View File

@@ -1,10 +1,12 @@
<%# locals: (weight:, color:) %>
<% effective_weight = weight.presence || 0 %>
<div class="w-full flex items-center justify-between gap-2">
<div class="flex gap-[3px]">
<% 10.times do |i| %>
<div class="w-0.5 h-2.5 rounded-lg <%= i < (weight / 10.0).ceil ? "" : "opacity-20" %>" style="background-color: <%= color %>;"></div>
<div class="w-0.5 h-2.5 rounded-lg <%= i < (effective_weight / 10.0).ceil ? "" : "opacity-20" %>" style="background-color: <%= color %>;"></div>
<% end %>
</div>
<p class="text-sm"><%= number_to_percentage(weight, precision: 2) %></p>
<p class="text-sm"><%= number_to_percentage(effective_weight, precision: 2) %></p>
</div>