Example #1
0
from __future__ import print_function
from __future__ import unicode_literals
from fbcache import FitbitCache
from optparse import OptionParser


usage = "usage: %prog user-name"
parser = OptionParser(usage)

(options, args) = parser.parse_args()

if len(args) != 1:
    parser.print_help()
    exit(1)
else:
    user_name = args[0]

cache = FitbitCache(user_name)

if not cache.data_exists():
    print("ERROR: Could not open data for user '{}'\n".format(user_name))
    parser.print_help()
    exit(1)

cache.read()
days = cache.daylist()

print('Start    = {}'.format(days[0]))
print('End      = {}'.format(days[-1]))
print('Num Days = {}'.format(cache.num_days()))
Example #2
0
if args.distance:
    print('will check distance values')
else:
    print('will NOT check distance values')

user_name = args.user_name

cache = FitbitCache(user_name)

if not cache.data_exists():
    print("ERROR: Could not open data for user '{}'\n".format(user_name))
    parser.print_help()
    exit(1)

cache.read()
days = cache.daylist()

current_date = days[0]
end_date = days[-1]

print('Start    = {}'.format(days[0]))
print('End      = {}'.format(days[-1]))
print('Num Days = {}'.format(cache.num_days()))

i = 0
while current_date <= end_date:
    s = ''
    day_data = cache[current_date]
    if 'date' not in day_data:
        day_data['date'] = current_date.strftime(dt_format)
Example #3
0
    parser.print_help()
    exit(1)
else:
    user_name = args[0]


cache = FitbitCache(user_name)
if cache.data_exists():
    cache.read()
else:
    parser.print_help()
    print('\n   ERROR: user {} does not have any data'.format(user_name))
    exit(1)

print("-------------- User: {} ----------------------".format(user_name))
print("\nDatabase contains %d entries" % len(cache.daylist()))

empty_days = cache.remove_days_without_steps()
print("\nRemoving days with zero steps")
for x in empty_days:
    print("    %s" % x)


missing_days = cache.find_missing_days()
if len(missing_days) > 0:
    print("\nThese days are missing from the database")
    for x in missing_days:
        print("    %s" % x)
else:
    print("\nThere are no missing dates")