Use stats_start_date field on sites

This commit is contained in:
Uku Taht 2022-04-06 11:10:00 +03:00
parent 0f43f4a9df
commit 5c290b1982
3 changed files with 1 additions and 11 deletions

View File

@ -70,14 +70,6 @@ defmodule Plausible.Sites do
end end
end end
def stats_begin(site) do
if site.imported_data do
site.imported_data.start_date
else
site.inserted_at
end
end
def create_shared_link(site, name, password \\ nil) do def create_shared_link(site, name, password \\ nil) do
changes = changes =
SharedLink.changeset( SharedLink.changeset(

View File

@ -22,7 +22,6 @@ defmodule PlausibleWeb.StatsController do
|> render("stats.html", |> render("stats.html",
site: site, site: site,
has_goals: Plausible.Sites.has_goals?(site), has_goals: Plausible.Sites.has_goals?(site),
stats_begin: Plausible.Sites.stats_begin(site),
title: "Plausible · " <> site.domain, title: "Plausible · " <> site.domain,
offer_email_report: offer_email_report, offer_email_report: offer_email_report,
demo: demo demo: demo
@ -178,7 +177,6 @@ defmodule PlausibleWeb.StatsController do
|> render("stats.html", |> render("stats.html",
site: shared_link.site, site: shared_link.site,
has_goals: Plausible.Sites.has_goals?(shared_link.site), has_goals: Plausible.Sites.has_goals?(shared_link.site),
stats_begin: Plausible.Sites.stats_begin(shared_link.site),
title: "Plausible · " <> shared_link.site.domain, title: "Plausible · " <> shared_link.site.domain,
offer_email_report: false, offer_email_report: false,
demo: false, demo: false,

View File

@ -12,7 +12,7 @@
<% end %> <% end %>
<div class="pt-6"></div> <div class="pt-6"></div>
<div id="stats-react-container" style="overflow-anchor: none;" data-domain="<%= @site.domain %>" data-offset="<%= Timex.Timezone.total_offset(Timex.Timezone.get(@site.timezone)) %>" data-has-goals="<%= @has_goals %>" data-logged-in="<%= !!@conn.assigns[:current_user] %>" data-stats-begin="<%= @stats_begin %>" data-shared-link-auth="<%= assigns[:shared_link_auth] %>" data-embedded="<%= @conn.assigns[:embedded] %>" data-background="<%= @conn.assigns[:background] %>" data-selfhosted="<%= Application.get_env(:plausible, :is_selfhost) %>" data-current-user-role="<%= @conn.assigns[:current_user_role] %>"></div> <div id="stats-react-container" style="overflow-anchor: none;" data-domain="<%= @site.domain %>" data-offset="<%= Timex.Timezone.total_offset(Timex.Timezone.get(@site.timezone)) %>" data-has-goals="<%= @has_goals %>" data-logged-in="<%= !!@conn.assigns[:current_user] %>" data-stats-begin="<%= @site.stats_start_date %>" data-shared-link-auth="<%= assigns[:shared_link_auth] %>" data-embedded="<%= @conn.assigns[:embedded] %>" data-background="<%= @conn.assigns[:background] %>" data-selfhosted="<%= Application.get_env(:plausible, :is_selfhost) %>" data-current-user-role="<%= @conn.assigns[:current_user_role] %>"></div>
<div id="modal_root"></div> <div id="modal_root"></div>
<%= if !@conn.assigns[:current_user] && @conn.assigns[:demo] do %> <%= if !@conn.assigns[:current_user] && @conn.assigns[:demo] do %>
<div class="bg-gray-50 dark:bg-gray-850"> <div class="bg-gray-50 dark:bg-gray-850">