From 6f02e8a50d65a8cfb27d1650cad6acc9fd994205 Mon Sep 17 00:00:00 2001 From: atomaka Date: Wed, 31 Aug 2011 02:54:50 -0400 Subject: [PATCH] Add code to check if Valor Points need to be reset. --- ChoreTracker.lua | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/ChoreTracker.lua b/ChoreTracker.lua index 01953b4..dd3b9de 100644 --- a/ChoreTracker.lua +++ b/ChoreTracker.lua @@ -156,7 +156,6 @@ function core:UpdateChores() local vpReset = core:GetNextVPReset() --store Valor Points - print(name,earnedThisWeek,vpReset) self.db.global.valorPoints[name] = {} self.db.global.valorPoints[name].points = earnedThisWeek self.db.global.valorPoints[name].resetTime = vpReset @@ -191,7 +190,13 @@ function core:ResetInstances() end 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 function core:GetNextVPReset() @@ -238,6 +243,6 @@ function core:GetNextVPReset() resetDate.hour = resetTime.hour resetDate.min = resetTime.min resetDate.sec = resetTime.sec - print(resetDate.hour,resetDate.min,resetDate.sec) + return time(resetDate) end \ No newline at end of file