Add code to check if Valor Points need to be reset.
This commit is contained in:
parent
e21711e684
commit
6f02e8a50d
1 changed files with 8 additions and 3 deletions
|
@ -156,7 +156,6 @@ function core:UpdateChores()
|
||||||
local vpReset = core:GetNextVPReset()
|
local vpReset = core:GetNextVPReset()
|
||||||
|
|
||||||
--store Valor Points
|
--store Valor Points
|
||||||
print(name,earnedThisWeek,vpReset)
|
|
||||||
self.db.global.valorPoints[name] = {}
|
self.db.global.valorPoints[name] = {}
|
||||||
self.db.global.valorPoints[name].points = earnedThisWeek
|
self.db.global.valorPoints[name].points = earnedThisWeek
|
||||||
self.db.global.valorPoints[name].resetTime = vpReset
|
self.db.global.valorPoints[name].resetTime = vpReset
|
||||||
|
@ -191,7 +190,13 @@ function core:ResetInstances()
|
||||||
end
|
end
|
||||||
|
|
||||||
function core:ResetValorPoints()
|
function core:ResetValorPoints()
|
||||||
|
for k,v in pairs(self.db.global.valorPoints) do
|
||||||
|
if v.resetTime ~= nil then
|
||||||
|
if v.resetTime < time() then
|
||||||
|
self.db.global.valorPoints[k] = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function core:GetNextVPReset()
|
function core:GetNextVPReset()
|
||||||
|
@ -238,6 +243,6 @@ function core:GetNextVPReset()
|
||||||
resetDate.hour = resetTime.hour
|
resetDate.hour = resetTime.hour
|
||||||
resetDate.min = resetTime.min
|
resetDate.min = resetTime.min
|
||||||
resetDate.sec = resetTime.sec
|
resetDate.sec = resetTime.sec
|
||||||
print(resetDate.hour,resetDate.min,resetDate.sec)
|
|
||||||
return time(resetDate)
|
return time(resetDate)
|
||||||
end
|
end
|
Loading…
Reference in a new issue