def report(self, from_date, to_date, detailed=False, with_rates=False): report_by_project = {} detailed_hours = {} report = TimeLog.get_client_summary_per_project(self, from_date, to_date, with_rates) if detailed: detailed_hours.update(TimeLog.get_client_task_log_summary_per_project(self, from_date, to_date)) report_by_project.update(report) report_by_project = sorted(report_by_project.items(), key=lambda x:x[0]) totalHrs = [] for p_id, usr_hs in report_by_project: totalHrs.append(sum(map(lambda x: x[1], usr_hs))) if detailed: def format_task_log(a,b,c): if not b[0] in a.keys(): return [] if not c[0] in a[b[0]]: return [] return a[b[0]][c[0]] report_by_project = map(lambda x: (x[0], map(lambda y: (y[0], y[1], format_task_log(detailed_hours, x, y)), x[1])), report_by_project) report_by_project = map(lambda (p,ul): (Project.objects.get(external_id=p).name,ul), report_by_project) return zip(report_by_project, totalHrs)
def report(self, from_date, to_date, project=None): report = list(TimeLog.report(self, from_date, to_date, project)) #Ordenamos por fecha report.sort(lambda x, y: cmp(datetime(x[4].year, x[4].month, x[4].day),\ datetime(y[4].year, y[4].month, y[4].day))) return report
def report(self, from_date, to_date, detailed=False, with_rates=False): report_by_project = {} detailed_hours = {} report = TimeLog.get_client_summary_per_project( self, from_date, to_date, with_rates) if detailed: summary = TimeLog.get_client_task_log_summary_per_project( self, from_date, to_date) detailed_hours.update(summary) report_by_project.update(report) report_by_project = sorted(report_by_project.items(), key=lambda x: x[0]) totalHrs = [] for p_id, usr_hs in report_by_project: totalHrs.append(sum(map(lambda x: x[1], usr_hs))) if detailed: def format_task_log(a, b, c): if not b[0] in a.keys(): return [] if not c[0] in a[b[0]]: return [] return a[b[0]][c[0]] report_by_project = map( lambda x: (x[0], map( lambda y: (y[0], y[1], format_task_log(detailed_hours, x, y)), x[1])), report_by_project) report_by_project = map( lambda (p, ul): (Project.objects.get(external_id=p).name, ul), report_by_project) return zip(report_by_project, totalHrs)
def projects(self, from_date, to_date): projects = TimeLog.user_projects(self, from_date, to_date) return projects