Changeset 67:4303a45e8a2f in stamper
- Timestamp:
 - Feb 1, 2018, 8:24:08 AM (8 years ago)
 - Branch:
 - default
 - Phase:
 - public
 - Files:
 - 
      
- 2 edited
 
- 
          
  etc/stamper.conf (modified) (1 diff)
 - 
          
  stamper/stamper.py (modified) (6 diffs)
 
 
Legend:
- Unmodified
 - Added
 - Removed
 
- 
      
etc/stamper.conf
r60 r67 8 8 time_format = %%H:%%M:%%S 9 9 datetime_format = %%Y-%%m-%%d %%H:%%M 10 wants_seconds = False 10 11 11 12 [sum]  - 
      
stamper/stamper.py
r63 r67 24 24 self.time_format = self.config.get('stamps', 'time_format') 25 25 self.datetime_format = self.config.get('stamps', 'datetime_format') 26 self.wants_seconds = self.config.get('stamps', 'wants_seconds') 26 27 self.hours_day = int(self.config.get('sum', 'hours_day')) 27 28 self.collector = self.config.get('collector') … … 159 160 totals[start_day] = 0 160 161 worktime = self.worktime(stamp['start'], stamp['end']) 162 str_worktime = str(timedelta(seconds=worktime)) 163 if not self.wants_seconds or self.wants_seconds == 'false': 164 # remove the seconds part from the string representation 165 str_worktime = ':'.join(str_worktime.split(':')[:-1]) 161 166 details[start_day].append( 162 167 '%(worktime)s %(customer)s %(action)s' % { 163 'worktime': str (timedelta(seconds=worktime)),168 'worktime': str_worktime, 164 169 'customer': customer, 165 170 'action': stamp['action'] … … 173 178 for day in totals: 174 179 totals[day] = str(timedelta(seconds=totals[day])) 180 if not self.wants_seconds or self.wants_seconds == 'false': 181 # remove the seconds part from the string representation 182 totals[day] = ':'.join(totals[day].split(':')[:-1]) 175 183 return details, totals, total_customer 176 184 … … 273 281 for tc in total_customer[day]: 274 282 tc_total = str(timedelta(seconds=total_customer[day][tc])) 283 if not self.wants_seconds or self.wants_seconds == 'false': 284 # remove the seconds part from the string representation 285 tc_total = ':'.join(tc_total.split(':')[:-1]) 275 286 customer_day_totals.append(tc+': '+tc_total) 276 287 print(', '.join(customer_day_totals)) … … 286 297 seconds=totals.get(customer, 0) 287 298 total = timedelta(seconds=totals.get(customer, 0)) 299 if not self.wants_seconds or self.wants_seconds == 'false': 300 # remove the seconds part from the string representation 301 total = ':'.join(str(total).split(':')[:-1]) 288 302 print(' %(customer)s: %(total)s' % {'customer': customer, 289 303 'total': total}) … … 292 306 seconds=totals[c] 293 307 total = timedelta(seconds=totals[c]) 308 if not self.wants_seconds or self.wants_seconds == 'false': 309 # remove the seconds part from the string representation 310 total = ':'.join(str(total).split(':')[:-1]) 294 311 print(' %(customer)s: %(total)s' % {'customer': c, 295 312 'total': total})  
  Note:
 See   TracChangeset
 for help on using the changeset viewer.
  