Aggiunge grafico andamento visite in admin Analytics.

Serie giornaliera di pageview/click/movimenti nel periodo filtrato, sopra la tabella pagine.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-08 21:52:29 +02:00
co-authored by Cursor
parent bb342ead79
commit 2e67e590d6
11 changed files with 171 additions and 1 deletions
@@ -36,6 +36,23 @@ module Admin
max_scroll: max_scroll_by_path[path].to_i
}
end.sort_by { |r| [-r[:pageviews], -r[:moves], -r[:clicks], r[:page_path]] }
pageviews_by_day = scope.group(:day).sum(:pageview_count)
clicks_by_day = cell_scope.group(:day).sum(:click_count)
moves_by_day = cell_scope.group(:day).sum(:move_count)
@trend = (@filters[:from]..@filters[:to]).map do |day|
{
day: day.iso8601,
pageviews: pageviews_by_day[day].to_i,
clicks: clicks_by_day[day].to_i,
moves: moves_by_day[day].to_i
}
end
@trend_totals = {
pageviews: @trend.sum { |r| r[:pageviews] },
clicks: @trend.sum { |r| r[:clicks] },
moves: @trend.sum { |r| r[:moves] }
}
end
def show