1
0
Fork 0

Add code to check if Valor Points need to be reset.

This commit is contained in:
Andrew Tomaka 2011-08-31 02:54:50 -04:00
parent e21711e684
commit 6f02e8a50d

View file

@ -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