Skip to content
Permalink
Browse files

💚 timelog

  • Loading branch information...
KolushovAlexandr committed Jul 2, 2019
1 parent 57a8e30 commit 520a12e902894a3490df7c886fe256156024b8f9
Showing with 4 additions and 4 deletions.
  1. +4 −4 project_timelog/models/project_timelog.py
@@ -202,7 +202,7 @@ def _search_im_status(self, operator, value):
WHERE user_id IN %s""", ("%s seconds" % DISCONNECTION_TIMER, "%s seconds" % AWAY_TIMER, tuple(ids)))
res = dict(((status['id'], status['status']) for status in self.env.cr.dictfetchall()))
if operator == '=':
value_ids = [id for id in ids if res.get(id, 'offline') == value]
value_ids = [vid for vid in ids if res.get(id, 'offline') == value]
return [('id', 'in', value_ids)]

# This function is called every 5 minutes
@@ -216,9 +216,9 @@ def check_stop_timer(self):
for u in user:
all_timelog = u.active_work_id.timelog_ids
sum_time = datetime.timedelta(0)
for id in all_timelog:
date_start_object = datetime.datetime.strptime(id.start_datetime, "%Y-%m-%d %H:%M:%S")
date_end_object = id.end_datetime and datetime.datetime.strptime(id.end_datetime, "%Y-%m-%d %H:%M:%S") or datetime.datetime.now()
for tid in all_timelog:
date_start_object = datetime.datetime.strptime(tid.start_datetime, "%Y-%m-%d %H:%M:%S")
date_end_object = tid.end_datetime and datetime.datetime.strptime(tid.end_datetime, "%Y-%m-%d %H:%M:%S") or datetime.datetime.now()
sum_time = sum_time + (date_end_object-date_start_object)
sum_time = int(round(sum_time.total_seconds(), 0))
if sum_time >= time_subtask:

0 comments on commit 520a12e

Please sign in to comment.
You can’t perform that action at this time.