Mercurial > getan
changeset 354:4f5094f3f615
Add method to calculate the total duration of a project
author | Björn Ricks <bjoern.ricks@intevation.de> |
---|---|
date | Mon, 03 Mar 2014 14:27:36 +0100 |
parents | 5ded6192b85b |
children | bc12acbff143 |
files | getan/project.py |
diffstat | 1 files changed, 7 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/getan/project.py Mon Mar 03 14:27:08 2014 +0100 +++ b/getan/project.py Mon Mar 03 14:27:36 2014 +0100 @@ -10,7 +10,7 @@ import locale -from datetime import datetime +from datetime import datetime, timedelta class Project(object): @@ -72,6 +72,12 @@ self.load_entries() return self._entries + def get_total_duration(self): + dur = timedelta(0) + for entry in self.entries: + dur += entry.get_duration() + return dur + class Entry(object):