Renames next_runtime to _next_runtime because its a temporary field not defined in the file format

This commit is contained in:
AliasAlreadyTaken 2024-05-29 00:59:00 +02:00
parent 1a2c8507ba
commit 1aeb45e0fc

View File

@ -25,7 +25,7 @@ local function calculate_bucket(bucket, data) -- This is per bucket
local n = 0
for _, announcement in ipairs(affected_announcements) do
announcement.next_runtime = os.time() + n * distance
announcement._next_runtime = os.time() + n * distance
n = n + 1
end
@ -55,9 +55,9 @@ local gs = function(dtime)
if ((type(announcement.runtime) == "number") and
(current_time >= (announcement.creation_date + announcement.runtime))) then
yl_announcements.delete(announcement.id)
elseif current_time >= (announcement.next_runtime or 0) then
elseif current_time >= (announcement._next_runtime or 0) then
if (type(announcement.next_runtime) ~= "number") then
if (type(announcement._next_runtime) ~= "number") then
table.insert(affected_bucket, announcement.frequency)
else
local a_success, message =
@ -69,8 +69,8 @@ local gs = function(dtime)
dump(announcement))
return
end
announcement.next_runtime =
announcement.next_runtime + (announcement.frequency or 3600)
announcement._next_runtime =
announcement._next_runtime + (announcement.frequency or 3600)
end
yl_announcements.say(os.date("!%H:%M:%S", os.time()) .. "=" ..
@ -78,7 +78,7 @@ local gs = function(dtime)
end
end
-- If there were any announcements that had no next_runtime, then we need to recalculate their bucket
-- If there were any announcements that had no _next_runtime, then we need to recalculate their bucket
for _, bucket in ipairs(affected_bucket) do
calculate_bucket(bucket, data)
end