summaryrefslogtreecommitdiff
path: root/app/income/models.py
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf.net>2019-01-13 11:51:02 -0600
committerluxagraf <sng@luxagraf.net>2019-01-13 11:51:02 -0600
commitc4da428fc9ec439389b7473ba5638d9f82085475 (patch)
tree2c135804e201b3008fe56db25d993881a49da686 /app/income/models.py
parent120021d565eefa0318c487f0ff5707c7b9893b43 (diff)
updated income and resume apps
Diffstat (limited to 'app/income/models.py')
-rw-r--r--app/income/models.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/app/income/models.py b/app/income/models.py
index 688d1d7..e5a351b 100644
--- a/app/income/models.py
+++ b/app/income/models.py
@@ -69,6 +69,9 @@ class InvoiceItem(models.Model):
time_end = models.DateTimeField(null=True, blank=True)
work_done = models.TextField(null=True, blank=True)
+ class Meta:
+ ordering = ('time_start',)
+
def __str__(self):
return str(self.time_start)
@@ -89,6 +92,12 @@ class InvoiceItem(models.Model):
half_period_seconds = period_seconds / 2
remainder = td.total_seconds() % period_seconds
if remainder >= half_period_seconds:
- return timedelta(seconds=td.total_seconds() + (period_seconds - remainder))
+ tdr = timedelta(seconds=td.total_seconds() + (period_seconds - remainder))
+ hours, remainder = divmod(tdr.total_seconds(), 3600)
+ r = remainder/3600
+ return float(hours)+r
else:
- return timedelta(seconds=td.total_seconds() - remainder)
+ tdr = timedelta(seconds=td.total_seconds() - remainder)
+ hours, remainder = divmod(tdr.total_seconds(), 3600)
+ r = remainder/3600
+ return float(hours)+r