Special calculations for sessions still in progress

This commit is contained in:
Trever Fischer
2012-04-21 10:45:22 -04:00
parent a48848246b
commit 418570681e

View File

@@ -27,7 +27,11 @@ class MinecraftProfile(models.Model):
def totalPlaytime(self):
total = datetime.datetime.now()-datetime.datetime.now()
for session in self.playersession_set.all():
total = total + session.end-session.start
if not session.end:
end = datetime.datetime.now()
else:
end = session.end
total = total + end-session.start
return total
def averagePlaytime(self):