#!/usr/bin/perl use lib "../lib"; use Rest::Topsy; use Data::Dumper; my $topsy = new Rest::Topsy; my $tasks = load_task_history($topsy); my $matches = []; foreach my $task (@$tasks) { next if $task->{'date'} == -1; foreach my $k (qw[all month week day hour]) { $task->{$k} =~ s/K$/000/; $task->{$k} =~ s/M$/000000/; } push @$matches, $task; } our $task_count = scalar(@$tasks); our $match_count = scalar(@$matches); our $percent = sprintf "%0.1f%%", 100* ($match_count/$task_count); print "Pulled $match_count/$task_count ($percent complete)\n"; print_report( "name", [(sort name_sort @$matches)] ); print_report( "all", [(sort { for $k (qw[all month week day hour]) { return $b->{$k} <=> $a->{$k} || next } } @$matches)] ); print_report( "month", [(sort { for $k (qw[month week day hour all]) { return $b->{$k} <=> $a->{$k} || next } } @$matches)] ); print_report( "week", [(sort { for $k (qw[week day hour all month]) { return $b->{$k} <=> $a->{$k} || next } } @$matches)] ); print_report( "day", [(sort { for $k (qw[day hour all month week]) { return $b->{$k} <=> $a->{$k} || next } } @$matches)] ); print_report( "hour", [(sort { for $k (qw[hour all month week day]) { return $b->{$k} <=> $a->{$k} || next } } @$matches)] ); sub print_report { my ($title, $matches) = @_; my $out .= header($title); foreach my $p (@$matches) { next unless $p->{$title}; $out .= "
| __HEADER__ $out .= join " | ", map { $current eq $_ ? "$_" : "$_" } qw[all month week day hour]; $out .= " | name | "; $out .= "
|---|