diff --git a/app/models/stat.rb b/app/models/stat.rb index eba82113..fe9d69cc 100644 --- a/app/models/stat.rb +++ b/app/models/stat.rb @@ -120,6 +120,10 @@ class Stat < ApplicationRecord } end + def process! + Stats::CalculatingJob.perform_later(user.id, year, month) + end + private def generate_sharing_uuid diff --git a/app/views/stats/public_month.html.erb b/app/views/stats/public_month.html.erb index 44d4a3ef..1cbbafef 100644 --- a/app/views/stats/public_month.html.erb +++ b/app/views/stats/public_month.html.erb @@ -1,186 +1,152 @@ - - - - - - Shared Stats - <%= Date::MONTHNAMES[@month] %> <%= @year %> - <%= csrf_meta_tags %> - <%= csp_meta_tag %> - - <%= stylesheet_link_tag "application", "data-turbo-track": "reload" %> - <%= javascript_importmap_tags %> - - - - - - - - <% if @self_hosted %> - - - <% end %> - - -
-
- -
-
-
-
-

- <%= "#{icon month_icon(@stat)} #{Date::MONTHNAMES[@month]} #{@year}".html_safe %> -

-

Monthly Digest

-
-
+
+ +
+
+
+
+

+ <%= "#{icon month_icon(@stat)} #{Date::MONTHNAMES[@month]} #{@year}".html_safe %> +

+

Monthly Digest

+
+
-
-
-
Distance traveled
-
<%= distance_traveled(@user, @stat) %>
-
Total distance for this month
-
+
+
+
Distance traveled
+
<%= distance_traveled(@user, @stat) %>
+
Total distance for this month
+
-
-
Active days
-
- <%= active_days(@stat) %> -
-
- Days with tracked activity -
-
- -
-
Countries visited
-
- <%= countries_visited(@stat) %> -
-
- Different countries -
-
+
+
Active days
+
+ <%= active_days(@stat) %>
- - -
-
- -
-
- - -
-
- -

Loading hexagons...

-
-
-
-
+
+ Days with tracked activity
+
- -
-
-

- <%= icon 'trending-up' %> Daily Activity -

-
- <%= column_chart( - @stat.daily_distance.map { |day, distance_meters| - [day, Stat.convert_distance(distance_meters, 'km').round] - }, - height: '200px', - suffix: " km", - xtitle: 'Day', - ytitle: 'Distance', - colors: [ - '#570df8', '#f000b8', '#ffea00', - '#00d084', '#3abff8', '#ff5724', - '#8e24aa', '#3949ab', '#00897b', - '#d81b60', '#5e35b1', '#039be5', - '#43a047', '#f4511e', '#6d4c41', - '#757575', '#546e7a', '#d32f2f' - ], - library: { - plugins: { - legend: { display: false } - }, - scales: { - x: { - grid: { color: 'rgba(0,0,0,0.1)' } - }, - y: { - grid: { color: 'rgba(0,0,0,0.1)' } - } - } - } - ) %> -
-
- Peak day: <%= peak_day(@stat) %> • Quietest week: <%= quietest_week(@stat) %> -
-
+
+
Countries visited
+
+ <%= countries_visited(@stat) %>
- - -
-
-

- <%= icon 'earth' %> Countries & Cities -

-
- <% @stat.toponyms.each_with_index do |country, index| %> -
-
- <%= country['country'] %> - <%= country['cities'].length %> cities -
- -
- <% end %> -
- -
- -
- Cities visited: - <% @stat.toponyms.each do |country| %> - <% country['cities'].first(5).each do |city| %> -
<%= city['city'] %>
- <% end %> - <% if country['cities'].length > 5 %> -
+<%= country['cities'].length - 5 %> more
- <% end %> - <% end %> -
-
+
+ Different countries
+
+
- -
-
- Powered by Dawarich, your personal memories mapper. + +
+
+ +
+
+ + +
+
+ +

Loading hexagons...

+
- - - + +
+
+

+ <%= icon 'trending-up' %> Daily Activity +

+
+ <%= column_chart( + @stat.daily_distance.map { |day, distance_meters| + [day, Stat.convert_distance(distance_meters, 'km').round] + }, + height: '200px', + suffix: " km", + xtitle: 'Day', + ytitle: 'Distance', + colors: [ + '#570df8', '#f000b8', '#ffea00', + '#00d084', '#3abff8', '#ff5724', + '#8e24aa', '#3949ab', '#00897b', + '#d81b60', '#5e35b1', '#039be5', + '#43a047', '#f4511e', '#6d4c41', + '#757575', '#546e7a', '#d32f2f' + ], + library: { + plugins: { + legend: { display: false } + }, + scales: { + x: { + grid: { color: 'rgba(0,0,0,0.1)' } + }, + y: { + grid: { color: 'rgba(0,0,0,0.1)' } + } + } + } + ) %> +
+
+ Peak day: <%= peak_day(@stat) %> • Quietest week: <%= quietest_week(@stat) %> +
+
+
+ + +
+
+

+ <%= icon 'earth' %> Countries & Cities +

+
+ <% @stat.toponyms.each_with_index do |country, index| %> +
+
+ <%= country['country'] %> + <%= country['cities'].length %> cities +
+ +
+ <% end %> +
+ +
+ +
+ Cities visited: + <% @stat.toponyms.each do |country| %> + <% country['cities'].first(5).each do |city| %> +
<%= city['city'] %>
+ <% end %> + <% if country['cities'].length > 5 %> +
+<%= country['cities'].length - 5 %> more
+ <% end %> + <% end %> +
+
+
+ + +
+
+ Powered by Dawarich, your personal memories mapper. +
+
+