Skip to content

Commit 087b6e7

Browse files
authored
last 90 days -> last 91 days (plausible#5301)
1 parent 59fa968 commit 087b6e7

11 files changed

Lines changed: 39 additions & 39 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ All notable changes to this project will be documented in this file.
66
### Added
77
- Ability to sort by and compare the `exit_rate` metric in the dashboard Exit Pages > Details report
88
- Add top 3 pages into the traffic spike email
9-
- Two new shorthand time periods `28d` and `90d` available on both dashboard and in public API
9+
- Two new shorthand time periods `28d` and `91d` available on both dashboard and in public API
1010
- Average scroll depth metric
1111
- Scroll Depth goals
1212
- Dashboard shows comparisons for all reports

assets/js/dashboard/nav-menu/query-periods/query-dates.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ test('if no period is stored, loads with default value of "Last 28 days", all ex
2828
['Realtime', 'R'],
2929
['Last 7 Days', 'W'],
3030
['Last 28 Days', 'F'],
31-
['Last 90 Days', 'N'],
31+
['Last 91 Days', 'N'],
3232
['Month to Date', 'M'],
3333
['Last Month', 'P'],
3434
['Year to Date', 'Y'],

assets/js/dashboard/query-time-periods.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export enum QueryPeriod {
3232
'7d' = '7d',
3333
'28d' = '28d',
3434
'30d' = '30d',
35-
'90d' = '90d',
35+
'91d' = '91d',
3636
'6mo' = '6mo',
3737
'12mo' = '12mo',
3838
'year' = 'year',
@@ -361,15 +361,15 @@ export const getDatePeriodGroups = ({
361361
}
362362
],
363363
[
364-
['Last 90 Days', 'N'],
364+
['Last 91 Days', 'N'],
365365
{
366366
search: (s) => ({
367367
...s,
368368
...clearedDateSearch,
369-
period: QueryPeriod['90d'],
369+
period: QueryPeriod['91d'],
370370
keybindHint: 'N'
371371
}),
372-
isActive: ({ query }) => query.period === QueryPeriod['90d'],
372+
isActive: ({ query }) => query.period === QueryPeriod['91d'],
373373
onEvent
374374
}
375375
]
@@ -611,8 +611,8 @@ export function getCurrentPeriodDisplayName({
611611
if (query.period === '30d') {
612612
return 'Last 30 days'
613613
}
614-
if (query.period === '90d') {
615-
return 'Last 90 days'
614+
if (query.period === '91d') {
615+
return 'Last 91 days'
616616
}
617617
if (query.period === 'month') {
618618
if (isThisMonth(site, query.date)) {

assets/js/dashboard/site-context.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ describe('parseSiteFromDataset', () => {
3030
data-current-user-role="owner"
3131
data-current-user-id="1"
3232
data-flags="{}"
33-
data-valid-intervals-by-period='{"12mo":["day","week","month"],"7d":["hour","day"],"28d":["day","week"],"30d":["day","week"],"90d":["day","week","month"],"6mo":["day","week","month"],"all":["week","month"],"custom":["day","week","month"],"day":["minute","hour"],"month":["day","week"],"realtime":["minute"],"year":["day","week","month"]}'
33+
data-valid-intervals-by-period='{"12mo":["day","week","month"],"7d":["hour","day"],"28d":["day","week"],"30d":["day","week"],"91d":["day","week","month"],"6mo":["day","week","month"],"all":["week","month"],"custom":["day","week","month"],"day":["minute","hour"],"month":["day","week"],"realtime":["minute"],"year":["day","week","month"]}'
3434
{...attrs}
3535
/>
3636
)
@@ -58,7 +58,7 @@ describe('parseSiteFromDataset', () => {
5858
'7d': ['hour', 'day'],
5959
'28d': ['day', 'week'],
6060
'30d': ['day', 'week'],
61-
'90d': ['day', 'week', 'month'],
61+
'91d': ['day', 'week', 'month'],
6262
'6mo': ['day', 'week', 'month'],
6363
all: ['week', 'month'],
6464
custom: ['day', 'week', 'month'],

assets/js/types/query-api.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export type DateRangeShorthand =
2424
| "7d"
2525
| "28d"
2626
| "30d"
27-
| "90d"
27+
| "91d"
2828
| "month"
2929
| "6mo"
3030
| "12mo"

lib/plausible/stats/interval.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ defmodule Plausible.Stats.Interval do
3131
case period do
3232
period when period in ["realtime", "30m"] -> "minute"
3333
"day" -> "hour"
34-
period when period in ["custom", "7d", "28d", "30d", "90d", "month"] -> "day"
34+
period when period in ["custom", "7d", "28d", "30d", "91d", "month"] -> "day"
3535
period when period in ["6mo", "12mo", "year"] -> "month"
3636
end
3737
end
@@ -59,7 +59,7 @@ defmodule Plausible.Stats.Interval do
5959
"7d" => ["hour", "day"],
6060
"28d" => ["day", "week"],
6161
"30d" => ["day", "week"],
62-
"90d" => ["day", "week", "month"],
62+
"91d" => ["day", "week", "month"],
6363
"month" => ["day", "week"],
6464
"6mo" => ["day", "week", "month"],
6565
"12mo" => ["day", "week", "month"],

lib/plausible/stats/legacy/legacy_query_builder.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ defmodule Plausible.Stats.Legacy.QueryBuilder do
9393
end
9494

9595
defp put_period(query, site, %{"period" => period} = params)
96-
when period in ["7d", "28d", "30d", "90d"] do
96+
when period in ["7d", "28d", "30d", "91d"] do
9797
{days, "d"} = Integer.parse(period)
9898

9999
end_date = parse_single_date(query, params) |> Date.shift(day: -1)

priv/json-schemas/query-api-schema.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,8 @@
201201
"description": "Last 30 days relative to today"
202202
},
203203
{
204-
"const": "90d",
205-
"description": "Last 90 days relative to today"
204+
"const": "91d",
205+
"description": "Last 91 days relative to today"
206206
},
207207
{
208208
"const": "month",

test/plausible/stats/interval_test.exs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ defmodule Plausible.Stats.IntervalTest do
3232
"7d" => ["hour", "day"],
3333
"28d" => ["day", "week"],
3434
"30d" => ["day", "week"],
35-
"90d" => ["day", "week", "month"],
35+
"91d" => ["day", "week", "month"],
3636
"6mo" => ["day", "week", "month"],
3737
"12mo" => ["day", "week", "month"],
3838
"year" => ["day", "week", "month"],
@@ -51,7 +51,7 @@ defmodule Plausible.Stats.IntervalTest do
5151
"7d" => ["hour", "day"],
5252
"28d" => ["day", "week"],
5353
"30d" => ["day", "week"],
54-
"90d" => ["day", "week", "month"],
54+
"91d" => ["day", "week", "month"],
5555
"6mo" => ["day", "week", "month"],
5656
"12mo" => ["day", "week", "month"],
5757
"year" => ["day", "week", "month"],
@@ -71,7 +71,7 @@ defmodule Plausible.Stats.IntervalTest do
7171
"7d" => ["hour", "day"],
7272
"28d" => ["day", "week"],
7373
"30d" => ["day", "week"],
74-
"90d" => ["day", "week", "month"],
74+
"91d" => ["day", "week", "month"],
7575
"6mo" => ["day", "week", "month"],
7676
"12mo" => ["day", "week", "month"],
7777
"year" => ["day", "week", "month"],

test/plausible_web/controllers/api/external_stats_controller/query_comparisons_test.exs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ defmodule PlausibleWeb.Api.ExternalStatsController.QueryComparisonsTest do
169169
assert actual_comparison_last_date == expected_comparison_last_date
170170
end
171171

172-
test "timeseries last 90d period in year_over_year comparison", %{
172+
test "timeseries last 91d period in year_over_year comparison", %{
173173
conn: conn,
174174
site: site
175175
} do
@@ -178,19 +178,19 @@ defmodule PlausibleWeb.Api.ExternalStatsController.QueryComparisonsTest do
178178
build(:pageview, timestamp: ~N[2021-04-01 00:00:00]),
179179
build(:pageview, timestamp: ~N[2021-04-05 00:00:00]),
180180
build(:pageview, timestamp: ~N[2021-04-05 00:00:00]),
181-
build(:pageview, timestamp: ~N[2021-06-29 00:00:00]),
181+
build(:pageview, timestamp: ~N[2021-06-30 00:00:00]),
182182
build(:pageview, timestamp: ~N[2022-04-01 00:00:00]),
183183
build(:pageview, timestamp: ~N[2022-04-05 00:00:00]),
184-
build(:pageview, timestamp: ~N[2022-06-29 00:00:00]),
185-
build(:pageview, timestamp: ~N[2022-06-30 00:00:00])
184+
build(:pageview, timestamp: ~N[2022-06-30 00:00:00]),
185+
build(:pageview, timestamp: ~N[2022-07-01 00:00:00])
186186
])
187187

188188
conn =
189189
post(conn, "/api/v2/query-internal-test", %{
190190
"site_id" => site.domain,
191191
"metrics" => ["visitors"],
192-
"date_range" => "90d",
193-
"date" => "2022-06-30",
192+
"date_range" => "91d",
193+
"date" => "2022-07-01",
194194
"dimensions" => ["time:day"],
195195
"include" => %{
196196
"time_labels" => true,
@@ -205,7 +205,7 @@ defmodule PlausibleWeb.Api.ExternalStatsController.QueryComparisonsTest do
205205

206206
assert "2022-04-01" = List.first(time_labels)
207207
assert "2022-04-05" = Enum.at(time_labels, 4)
208-
assert "2022-06-29" = List.last(time_labels)
208+
assert "2022-06-30" = List.last(time_labels)
209209

210210
assert %{
211211
"dimensions" => ["2022-04-01"],
@@ -226,13 +226,13 @@ defmodule PlausibleWeb.Api.ExternalStatsController.QueryComparisonsTest do
226226
} = Enum.find(results, &(&1["dimensions"] == ["2022-04-05"]))
227227

228228
assert %{
229-
"dimensions" => ["2022-06-29"],
229+
"dimensions" => ["2022-06-30"],
230230
"metrics" => [1],
231231
"comparison" => %{
232-
"dimensions" => ["2021-06-29"],
232+
"dimensions" => ["2021-06-30"],
233233
"metrics" => [1]
234234
}
235-
} = Enum.find(results, &(&1["dimensions"] == ["2022-06-29"]))
235+
} = Enum.find(results, &(&1["dimensions"] == ["2022-06-30"]))
236236
end
237237

238238
test "dimensional comparison with low limit", %{conn: conn, site: site} do

0 commit comments

Comments
 (0)