diff --git a/Journalator/Locales/enUS.lua b/Journalator/Locales/enUS.lua index b57ba78..f8b293f 100755 --- a/Journalator/Locales/enUS.lua +++ b/Journalator/Locales/enUS.lua @@ -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" diff --git a/Journalator/Source/Constants.lua b/Journalator/Source/Constants.lua index 9880dee..3f85075 100644 --- a/Journalator/Source/Constants.lua +++ b/Journalator/Source/Constants.lua @@ -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 = { @@ -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, } } diff --git a/Journalator_Display/Source/Display/FiltersContainer.lua b/Journalator_Display/Source/Display/FiltersContainer.lua index 082384a..0fc0d54 100644 --- a/Journalator_Display/Source/Display/FiltersContainer.lua +++ b/Journalator_Display/Source/Display/FiltersContainer.lua @@ -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 }) @@ -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 @@ -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