mirror of
https://github.com/we-promise/sure.git
synced 2026-04-20 12:34:12 +00:00
Implement caching for classification and account groups in BalanceSheet model and optimize sparkline rendering in views
- Add caching for classification groups and account groups in the BalanceSheet model to improve performance. - Update views for accountable sparklines to utilize caching for rendered HTML, enhancing load times and reducing database queries.
This commit is contained in:
@@ -1,11 +1,13 @@
|
||||
<%= turbo_frame_tag "#{@accountable.model_name.param_key}_sparkline" do %>
|
||||
<div class="flex items-center justify-end gap-1">
|
||||
<div class="w-8 h-3">
|
||||
<%= render "shared/sparkline", id: dom_id(@accountable, :sparkline_chart), series: @series %>
|
||||
</div>
|
||||
<% cache Current.family.build_cache_key("#{@accountable.name}_sparkline_html") do %>
|
||||
<%= turbo_frame_tag "#{@accountable.model_name.param_key}_sparkline" do %>
|
||||
<div class="flex items-center justify-end gap-1">
|
||||
<div class="w-8 h-3">
|
||||
<%= render "shared/sparkline", id: dom_id(@accountable, :sparkline_chart), series: @series %>
|
||||
</div>
|
||||
|
||||
<%= tag.p @series.trend.percent_formatted,
|
||||
style: "color: #{@series.trend.color}",
|
||||
class: "font-mono text-right text-xs font-medium text-primary" %>
|
||||
</div>
|
||||
<%= tag.p @series.trend.percent_formatted,
|
||||
style: "color: #{@series.trend.color}",
|
||||
class: "font-mono text-right text-xs font-medium text-primary" %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
<%= turbo_frame_tag dom_id(@account, :sparkline) do %>
|
||||
<div class="flex items-center justify-end gap-1">
|
||||
<div class="w-8 h-5">
|
||||
<%= render "shared/sparkline", id: dom_id(@account, :sparkline_chart), series: @account.sparkline_series %>
|
||||
</div>
|
||||
<% cache Current.family.build_cache_key("account_#{@account.id}_sparkline_html") do %>
|
||||
<%= turbo_frame_tag dom_id(@account, :sparkline) do %>
|
||||
<div class="flex items-center justify-end gap-1">
|
||||
<div class="w-8 h-5">
|
||||
<%= render "shared/sparkline", id: dom_id(@account, :sparkline_chart), series: @account.sparkline_series %>
|
||||
</div>
|
||||
|
||||
<%= tag.p @account.sparkline_series.trend.percent_formatted,
|
||||
style: "color: #{@account.sparkline_series.trend.color}",
|
||||
class: "font-mono text-right text-xs font-medium text-primary" %>
|
||||
</div>
|
||||
<%= tag.p @account.sparkline_series.trend.percent_formatted,
|
||||
style: "color: #{@account.sparkline_series.trend.color}",
|
||||
class: "font-mono text-right text-xs font-medium text-primary" %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
Reference in New Issue
Block a user