Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Journalator/Locales/enUS.lua
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ JOURNALATOR_LOCALES.enUS = function()
L["LAST_MONTH"] = "Last month"
L["LAST_WEEK"] = "Last week"
L["LAST_DAY"] = "Last day"
L["SERVER_DAY"] = "Server day"
L["SERVER_WEEK"] = "Server week"
L["LAST_HOUR"] = "Last hour"
L["ALL_REALMS"] = "All Realms"
L["SOME_REALMS"] = "Some Realms"
Expand Down
4 changes: 4 additions & 0 deletions Journalator/Source/Constants.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ Journalator.Constants.TimePeriods = {
JOURNALATOR_L_LAST_3_MONTHS,
JOURNALATOR_L_LAST_MONTH,
JOURNALATOR_L_LAST_WEEK,
JOURNALATOR_L_SERVER_WEEK,
JOURNALATOR_L_LAST_DAY,
JOURNALATOR_L_SERVER_DAY,
JOURNALATOR_L_LAST_HOUR,
},
Values = {
Expand All @@ -31,7 +33,9 @@ Journalator.Constants.TimePeriods = {
SECONDS_IN_A_MONTH * 3,
SECONDS_IN_A_MONTH,
7 * 24 * 60 * 60,
"server_week",
24 * 60 * 60,
"server_day",
60 * 60,
}
}
Expand Down
22 changes: 19 additions & 3 deletions Journalator_Display/Source/Display/FiltersContainer.lua
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
JournalatorFiltersContainerMixin = {}

function JournalatorFiltersContainerMixin:OnLoad()
local now = time()
-- Used to only scan segments already open for realms and characters
self.earliestRangeTime = time()
self.earliestRangeTime = now

self.lastDailyResetTime = now - 86400 + C_DateAndTime.GetSecondsUntilDailyReset()
self.lastWeeklyResetTime = now - 7 * 86400 + C_DateAndTime.GetSecondsUntilWeeklyReset()

Auctionator.EventBus:Register(self, {
Journalator.Events.RowClicked
})
Expand Down Expand Up @@ -79,7 +83,11 @@ end

function JournalatorFiltersContainerMixin:GetTimeForRange()
local secondsToInclude = self.TimePeriodDropDown:GetValue()
if secondsToInclude == 0 then
if secondsToInclude == "server_day" then
return self.lastDailyResetTime
elseif secondsToInclude == "server_week" then
return self.lastWeeklyResetTime
elseif secondsToInclude == 0 then
return 0
else
return time() - secondsToInclude
Expand All @@ -90,7 +98,15 @@ function JournalatorFiltersContainerMixin:Filter(item)
local check = true

if self.filters.secondsToInclude ~= 0 then
check = check and (time() - item.time) <= self.filters.secondsToInclude
local now = time()
local itemAge = now - item.time
if self.filters.secondsToInclude == "server_day" then
check = check and itemAge <= now - self.lastDailyResetTime
elseif self.filters.secondsToInclude == "server_week" then
check = check and itemAge <= now - self.lastWeeklyResetTime
else
check = check and itemAge <= self.filters.secondsToInclude
end
end

-- Work around one-time error when source data wasn't saved
Expand Down