mirror of
https://github.com/we-promise/sure.git
synced 2026-04-10 07:44:48 +00:00
* Reindent TimeSeries classes * Fix spacing in time series tests * Remove trend tests where current is nil I think if we've gotten this far with a nil value for current, there's a data integrity problem. If we allow this, we'll have to be very defensive in our code. Best to raise and fix early. * Reindent Money class * Refactor TimeSeries artifacts * Use as_json in TimeSeries * Bring back tests for trends where current is nil * Bring back trend test * Correctly enumerate trend test * Use favorable_direction for trend_styles helper * Make trend public in TimeSeries::Value * Allow nil current values in trends I think I might've gotten it wrong before, nils might appear in trends if values are unavailable for snapshots * Clean up TimeSeries::Trend * Skip trend values same class validations if any values are nil * Refactor Money * Remove object parsing in TimeSeries::Value We're only every passing hashes
11 lines
436 B
Plaintext
11 lines
436 B
Plaintext
<%# locals: { trend: } %>
|
|
<% styles = trend_styles(trend) %>
|
|
<p class="text-sm <%= styles[:text_class] %>">
|
|
<% if trend.direction.flat? %>
|
|
<span>No change</span>
|
|
<% else %>
|
|
<span><%= styles[:symbol] %><%= trend.value.is_a?(Money) ? format_money(trend.value.abs) : trend.value.abs %></span>
|
|
<span>(<%= lucide_icon(styles[:icon], class: "w-4 h-4 align-text-bottom inline") %><%= trend.percent %>%)</span>
|
|
<% end %>
|
|
</p>
|