Changeset 28:9afaa509f383 in stamper


Ignore:
Timestamp:
Aug 8, 2014, 9:00:43 AM (10 years ago)
Author:
Borja Lopez <borja@…>
Branch:
default
Phase:
public
Message:

Added the "timeline" feature (stamps -t), which prints on screen a
timeline of the recorded entries, in betabug's stamp "old style".

Useful for two purposes:

1) Export recorded times to be used by betabug's stamp

2) Get a quick view of your latest records (to notice if the last

one was a start, for example

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • bin/stamps

    r23 r28  
    1919    parser.add_argument('-g', '--graph', action="store_true",
    2020                        help='Generate a SVG graph')
     21    parser.add_argument('-t', '--timeline', action="store_true",
     22                        help='Show a timeline of recorded times')
    2123
    2224    args = parser.parse_args()
     
    2426    s = Stamper()
    2527    s.load_stamps()
    26     s.show_stamps(args.customer, args.filter, args.verbose, args.sum,
    27         args.graph)
     28    if args.timeline:
     29        s.timeline()
     30    else:
     31        s.show_stamps(args.customer, args.filter, args.verbose, args.sum,
     32                      args.graph)
  • stamper/stamper.py

    r26 r28  
    201201            totals[day] = str(timedelta(seconds=totals[day]))
    202202        return details, totals, total_customer
     203
     204    def timeline(self):
     205        for stamp in self.stamps:
     206            customer = stamp['customer']
     207            if not stamp['customer']:
     208                print(stamp['start'] + ' start')
     209            else:
     210                print(' '.join([stamp['end'],
     211                                stamp['customer'],
     212                                stamp['action']]))
    203213
    204214    def show_stamps(self, customer=None, stamp_filter=None, verbose=False,
Note: See TracChangeset for help on using the changeset viewer.