comparison Modules/Collected.lua @ 78:bd80e4b4042f

Fixed time spent tracker.
author Zerotorescue
date Thu, 16 Sep 2010 16:21:30 +0200
parents 364791db5503
children 5fe1f61452a1
comparison
equal deleted inserted replaced
77:aabb70411186 78:bd80e4b4042f
224 -- Message buffer, append details we have data for 224 -- Message buffer, append details we have data for
225 local printMessage = ""; 225 local printMessage = "";
226 226
227 local timeSpent, tempSessionTimeSpent; 227 local timeSpent, tempSessionTimeSpent;
228 if timeStarted then 228 if timeStarted then
229 timeSpent = ( GetTime() - timeStarted ); 229 timeSpent = ceil( GetTime() - timeStarted );
230 230
231 if self.db.profile.sessionSummary and self.db.profile.trackTimeSpent then 231 if self.db.profile.sessionSummary and self.db.profile.trackTimeSpent then
232 tempSessionTimeSpent = ( sessionTimeSpent + timeSpent ); 232 tempSessionTimeSpent = ( sessionTimeSpent + timeSpent );
233 233
234 if full then 234 if full then
235 -- Only remember the timespent when the mailbox is closed 235 -- Only remember the timespent when the mailbox is closed
236 sessionTimeSpent = tempSessionTimeSpent; 236 sessionTimeSpent = tempSessionTimeSpent;
237 end 237 end
238 end 238 end
239
240 self:Debug(timeSpent);
239 end 241 end
240 242
241 -- Did we record any mail being opened? 243 -- Did we record any mail being opened?
242 if mailOpened and mailOpened > 0 then 244 if mailOpened and mailOpened > 0 then
243 -- Time Spent 245 -- Time Spent
254 end 256 end
255 elseif timeSpent and timeSpent > 0 then 257 elseif timeSpent and timeSpent > 0 then
256 local timeSpentMinutes = floor( timeSpent / 60 ); 258 local timeSpentMinutes = floor( timeSpent / 60 );
257 local timeSpentSeconds = ( timeSpent % 60 ); 259 local timeSpentSeconds = ( timeSpent % 60 );
258 if timeSpentMinutes ~= 0 then 260 if timeSpentMinutes ~= 0 then
259 printMessage = printMessage .. format(L["Spent %d minutes and %d seconds collecting mail."], mailOpened, timeSpentMinutes, timeSpentSeconds) .. " "; 261 printMessage = printMessage .. format(L["Spent %d minutes and %d seconds collecting mail."], timeSpentMinutes, timeSpentSeconds) .. " ";
260 else 262 else
261 printMessage = printMessage .. format(L["Spent %d seconds collecting mail."], mailOpened, timeSpentSeconds) .. " "; 263 printMessage = printMessage .. format(L["Spent %d seconds collecting mail."], timeSpentSeconds) .. " ";
262 end 264 end
263 end 265 end
264 266
265 -- Did we record any items or gold being looted? 267 -- Did we record any items or gold being looted?
266 if (itemsGained and itemsGained > 0) and (earned and earned > 0) then 268 if (itemsGained and itemsGained > 0) and (earned and earned > 0) then
285 -- Time Spent 287 -- Time Spent
286 if tempSessionTimeSpent and tempSessionTimeSpent > 0 then 288 if tempSessionTimeSpent and tempSessionTimeSpent > 0 then
287 local timeSpentMinutes = floor( tempSessionTimeSpent / 60 ); 289 local timeSpentMinutes = floor( tempSessionTimeSpent / 60 );
288 local timeSpentSeconds = ( tempSessionTimeSpent % 60 ); 290 local timeSpentSeconds = ( tempSessionTimeSpent % 60 );
289 if timeSpentMinutes ~= 0 then 291 if timeSpentMinutes ~= 0 then
290 printMessage = printMessage .. format(L["Collected a total of %d mail within %d minutes and %d seconds this session."], mailOpened, timeSpentMinutes, timeSpentSeconds) .. " "; 292 printMessage = printMessage .. format(L["Collected a total of %d mail within %d minutes and %d seconds this session."], sessionMailOpened, timeSpentMinutes, timeSpentSeconds) .. " ";
291 else 293 else
292 printMessage = printMessage .. format(L["Collected a total of %d mail within %d seconds this session."], mailOpened, timeSpentSeconds) .. " "; 294 printMessage = printMessage .. format(L["Collected a total of %d mail within %d seconds this session."], sessionMailOpened, timeSpentSeconds) .. " ";
293 end 295 end
294 else 296 else
295 printMessage = printMessage .. format(L["Collected a total of %d mail this session."], sessionMailOpened) .. " "; 297 printMessage = printMessage .. format(L["Collected a total of %d mail this session."], sessionMailOpened) .. " ";
296 end 298 end
297 elseif tempSessionTimeSpent then 299 elseif tempSessionTimeSpent then
298 local timeSpentMinutes = floor( tempSessionTimeSpent / 60 ); 300 local timeSpentMinutes = floor( tempSessionTimeSpent / 60 );
299 local timeSpentSeconds = ( tempSessionTimeSpent % 60 ); 301 local timeSpentSeconds = ( tempSessionTimeSpent % 60 );
300 if timeSpentMinutes ~= 0 then 302 if timeSpentMinutes ~= 0 then
301 printMessage = printMessage .. format(L["Spent %d minutes and %d seconds collecting mail this session."], mailOpened, timeSpentMinutes, timeSpentSeconds) .. " "; 303 printMessage = printMessage .. format(L["Spent %d minutes and %d seconds collecting mail this session."], timeSpentMinutes, timeSpentSeconds) .. " ";
302 else 304 else
303 printMessage = printMessage .. format(L["Spent %d seconds collecting mail this session."], mailOpened, timeSpentSeconds) .. " "; 305 printMessage = printMessage .. format(L["Spent %d seconds collecting mail this session."], timeSpentSeconds) .. " ";
304 end 306 end
305 end 307 end
306 308
307 -- Did we record any items or gold being looted? 309 -- Did we record any items or gold being looted?
308 if (sessionItemsgained and sessionItemsgained > 0) and (sessionEarned and sessionEarned > 0) then 310 if (sessionItemsgained and sessionItemsgained > 0) and (sessionEarned and sessionEarned > 0) then