start_date = two_weeks_ago(end_date) #reset to the end of the day end_date = end_day(end_date) #reset to the beginning of that day start_date = start_day(start_date) if start_date > end_date: print "Error, start date is after end date." sys.exit(0) for project in our_projects.keys(): print "Retrievin data for %s" % our_projects[project] all_entries.extend(conn.get_project_time(project)) summary = {} for project in our_projects.keys(): summary[project] = {} for person in our_people.keys(): summary[project][person] = 0.0 for entry in all_entries: if entry.date >= start_date and entry.date <= end_date: summary[entry.project_id][entry.person_id] += entry.hours #print entry.hours, entry.date, our_people[entry.person_id], our_projects[entry.project_id] for project in summary.keys(): print "Project %s" % our_projects[project]
projects = conn.project_id_map() print "ID:Project" for id in projects: print "%d:%s" % (id, projects[id]) # get all of the time entries # a hash {project id:[time entires]} time_entries = dict([(id, []) for id in projects]) # for each project id for project in projects: print "Retrieving data for %s" % projects[project] # get ALL the entires for the project entries = conn.get_project_time(project) for entry in entries: print "%s, %s, %3.2f Hours, on %s." % ( projects[entry.project_id].upper(), people[entry.person_id], entry.hours, entry.date.date, ) # for entry in entries.data: # filter them according to the start and end date for entry in entries: if entry.date >= start_date and entry.date <= end_date: # print "%s, %s, %3.2f Hours, on %s." % (projects[entry.project_id].upper(),people[entry.person_id],entry.hours,entry.date.date) time_entries[project].append(entry) else:
return datetime.date(int(year),int(month),int(day)) basecamp_url = raw_input('BaseCamp URL.') username = raw_input('BaseCamp UserName:'******'BaseCamp PassWord:'******'Start') print "Start date is",start_date end_date = get_date('End Date') print "End date is",end_date if start_date > end_date: print "Error, start date is after end date." sys.exit(0) for project in our_projects.keys(): print "Retrievin data for %s" % our_projects[project]