Browse Source

misc work and add screenshot

tags/0.1.0
Zane C. B-H 4 months ago
parent
commit
ac929cff82
4 changed files with 51 additions and 2 deletions
  1. +4
    -0
      Git-PunchCard/Changes
  2. +19
    -2
      Git-PunchCard/bin/punchcard-git
  3. +28
    -0
      Git-PunchCard/lib/Git/PunchCard.pm
  4. BIN
      screenshot.png

+ 4
- 0
Git-PunchCard/Changes View File

@@ -1,5 +1,9 @@
Revision history for Git-PunchCard

0.1.0 2019-07-15/22:15
- Display max.
- Add avagerage/min.

0.0.1 2019-07-15/06:20
- Set LC_ALL=C when calling git.
- Properly set hourly max for the day.

+ 19
- 2
Git-PunchCard/bin/punchcard-git View File

@@ -129,7 +129,10 @@ my $table=Text::Table->new(
'21',
'22',
'23',
'Total'
'Total',
'Max',
'Avg',
'Min'
);

my $card=$gpc->get_card;
@@ -145,14 +148,28 @@ foreach my $day ( @days ){
push( @line, color($colors[$color_to_use]).$card->{$day}{$hour}.color('WHITE') );
}

my $min_color=13*($card->{$day}{min}/$card->{max});
my $average_color=13*($card->{$day}{average}/$card->{max});
my $max_color=13*($card->{$day}{max}/$card->{max});
push( @line, $card->{$day}{total}.color('WHITE') );
push( @line, color($colors[$max_color]).$card->{$day}{max}.color('WHITE') );
push( @line, color($colors[$average_color]).sprintf('%.1f',$card->{$day}{average}).color('WHITE') );
push( @line, color($colors[$min_color]).$card->{$day}{min}.color('WHITE') );

push( @data, \@line );
}

$table->load( @data );

print $table."\nTotal: ".$card->{total}."\nHourly Max=".$card->{max}."\nAverage=".$card->{average}."\n";
my $min_color=13*($card->{min}/$card->{max});
my $average_color=13*($card->{average}/$card->{max});

print $table.
"\nTotal: ".$card->{total}.
"\nMax=".color($colors[13]).$card->{max}.color('WHITE').
"\nAverage=".color($colors[$average_color]).sprintf("%.1f",$card->{average}).color('WHITE').
"\nMin=".color($colors[$min_color]).$card->{min}.color('WHITE')."\n";

=head1 NAME


+ 28
- 0
Git-PunchCard/lib/Git/PunchCard.pm View File

@@ -98,9 +98,13 @@ sub new {
card=>{
total=>0,
max=>0,
average=>0,
min=>9999999999999999999999999999999999,
Sun=>{
total=>0,
max=>0,
average=>0,
min=>9999999999999999999999999999999999,
'00'=>0,
'01'=>0,
'02'=>0,
@@ -129,6 +133,8 @@ sub new {
Mon=>{
total=>0,
max=>0,
average=>0,
min=>9999999999999999999999999999999999,
'00'=>0,
'01'=>0,
'02'=>0,
@@ -157,6 +163,8 @@ sub new {
Tue=>{
total=>0,
max=>0,
average=>0,
min=>9999999999999999999999999999999999,
'00'=>0,
'01'=>0,
'02'=>0,
@@ -185,6 +193,8 @@ sub new {
Wed=>{
total=>0,
max=>0,
average=>0,
min=>9999999999999999999999999999999999,
'00'=>0,
'01'=>0,
'02'=>0,
@@ -213,6 +223,8 @@ sub new {
Thu=>{
total=>0,
max=>0,
average=>0,
min=>9999999999999999999999999999999999,
'00'=>0,
'01'=>0,
'02'=>0,
@@ -241,6 +253,8 @@ sub new {
Fri=>{
total=>0,
max=>0,
average=>0,
min=>9999999999999999999999999999999999,
'00'=>0,
'01'=>0,
'02'=>0,
@@ -269,6 +283,8 @@ sub new {
Sat=>{
total=>0,
max=>0,
average=>0,
min=>9999999999999999999999999999999999,
'00'=>0,
'01'=>0,
'02'=>0,
@@ -367,6 +383,18 @@ sub dir {

$self->{card}{average}= $self->{card}{total} / 168 ;

foreach my $day ( 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat' ){
for my $hour ( '00', '01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23' ){
if ( $self->{card}{$day}{$hour} < $self->{card}{$day}{min} ){
$self->{card}{$day}{min}=$self->{card}{$day}{$hour};
}
if ( $self->{card}{$day}{$hour} < $self->{card}{min} ){
$self->{card}{min}=$self->{card}{$day}{$hour};
}
}
}

return 1;
}


BIN
screenshot.png View File

Before After
Width: 1277  |  Height: 293  |  Size: 40KB

Loading…
Cancel
Save