Mercurial > wow > mailopener
changeset 76:364791db5503
Hopefully fixed the session time spent tracker.
Forgot some localizations in the Collected module.
| author | Zerotorescue |
|---|---|
| date | Wed, 15 Sep 2010 23:51:43 +0200 |
| parents | 5dcc50650dd3 |
| children | aabb70411186 |
| files | Modules/Collected.lua |
| diffstat | 1 files changed, 20 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/Modules/Collected.lua Wed Sep 15 17:33:41 2010 +0200 +++ b/Modules/Collected.lua Wed Sep 15 23:51:43 2010 +0200 @@ -106,7 +106,7 @@ function mod:MAIL_CLOSED() self:Debug("MAIL_CLOSED"); - self:Summarize(); + self:Summarize(true); self:Stop(); end @@ -187,7 +187,7 @@ function mod:MO_OPEN_COMPLETE() -- Only summarize when changed if updated then - self:Summarize(); + self:Summarize(false); updated = false; end @@ -220,16 +220,21 @@ timeStarted = nil; end -function mod:Summarize() +function mod:Summarize(full) -- Message buffer, append details we have data for local printMessage = ""; - local timeSpent; + local timeSpent, tempSessionTimeSpent; if timeStarted then timeSpent = ( GetTime() - timeStarted ); + + if self.db.profile.sessionSummary and self.db.profile.trackTimeSpent then + tempSessionTimeSpent = ( sessionTimeSpent + timeSpent ); - if self.db.profile.sessionSummary and self.db.profile.trackTimeSpent then - sessionTimeSpent = ( sessionTimeSpent + timeSpent ); + if full then + -- Only remember the timespent when the mailbox is closed + sessionTimeSpent = tempSessionTimeSpent; + end end end @@ -242,7 +247,7 @@ if timeSpentMinutes ~= 0 then printMessage = printMessage .. format(L["Collected a total of %d mail within %d minutes and %d seconds."], mailOpened, timeSpentMinutes, timeSpentSeconds) .. " "; else - printMessage = printMessage .. format("Collected a total of %d mail within %d seconds.", mailOpened, timeSpentSeconds) .. " "; + printMessage = printMessage .. format(L["Collected a total of %d mail within %d seconds."], mailOpened, timeSpentSeconds) .. " "; end else printMessage = printMessage .. format(L["Collected a total of %d mail."], mailOpened) .. " "; @@ -271,16 +276,16 @@ MailOpener:Print(printMessage); end - if self.db.profile.sessionSummary and ((sessionMailOpened and (not mailOpened or sessionMailOpened > mailOpened)) or (sessionTimeSpent and (not timeSpent or sessionTimeSpent > timeSpent)) or (sessionEarned and (not earned or sessionEarned > earned)) or (sessionItemsgained and (not itemsGained or sessionItemsgained > itemsGained))) then + if self.db.profile.sessionSummary and ((sessionMailOpened and (not mailOpened or sessionMailOpened > mailOpened)) or (tempSessionTimeSpent and (not timeSpent or tempSessionTimeSpent > timeSpent)) or (sessionEarned and (not earned or sessionEarned > earned)) or (sessionItemsgained and (not itemsGained or sessionItemsgained > itemsGained))) then -- Message buffer, append details we have data for - printMessage = "(Session summary)" .. " "; + printMessage = L["(Session summary)"] .. " "; -- Did we record any mail being opened? if sessionMailOpened and sessionMailOpened > 0 then -- Time Spent - if sessionTimeSpent and sessionTimeSpent > 0 then - local timeSpentMinutes = floor( sessionTimeSpent / 60 ); - local timeSpentSeconds = ( sessionTimeSpent % 60 ); + if tempSessionTimeSpent and tempSessionTimeSpent > 0 then + local timeSpentMinutes = floor( tempSessionTimeSpent / 60 ); + local timeSpentSeconds = ( tempSessionTimeSpent % 60 ); if timeSpentMinutes ~= 0 then printMessage = printMessage .. format(L["Collected a total of %d mail within %d minutes and %d seconds this session."], mailOpened, timeSpentMinutes, timeSpentSeconds) .. " "; else @@ -289,9 +294,9 @@ else printMessage = printMessage .. format(L["Collected a total of %d mail this session."], sessionMailOpened) .. " "; end - elseif sessionTimeSpent then - local timeSpentMinutes = floor( sessionTimeSpent / 60 ); - local timeSpentSeconds = ( sessionTimeSpent % 60 ); + elseif tempSessionTimeSpent then + local timeSpentMinutes = floor( tempSessionTimeSpent / 60 ); + local timeSpentSeconds = ( tempSessionTimeSpent % 60 ); if timeSpentMinutes ~= 0 then printMessage = printMessage .. format(L["Spent %d minutes and %d seconds collecting mail this session."], mailOpened, timeSpentMinutes, timeSpentSeconds) .. " "; else
