Merge pull request 'Issue #4: Improved formatting of constructor and driver standings.' (#7) from issue-4-formatting into master
This commit is contained in:
parent
d39a2f15e2
commit
a37f0bd317
19
F1DataBot.pm
19
F1DataBot.pm
@ -193,13 +193,13 @@ sub statistics {
|
||||
{}
|
||||
);
|
||||
my %DriverStandings;
|
||||
my $DriverStandingsFormatted = sprintf( "%-3s%-4s%-5s%7s\n",
|
||||
my $DriverStandingsFormatted = sprintf( "%2s %3s %-5s%7s\n",
|
||||
"#", "No.", "Code", "Points" );
|
||||
for my $Driver ( $Standings->{MRData}->{StandingsTable}
|
||||
->{StandingsLists}->[0]->{DriverStandings}->@* )
|
||||
{
|
||||
$DriverStandingsFormatted .= sprintf(
|
||||
"%-3d%-4d%-5s%7d\n",
|
||||
"%2d %3d %-5s%7d\n",
|
||||
$Driver->{positionText},
|
||||
$Driver->{Driver}->{permanentNumber},
|
||||
$Driver->{Driver}->{code},
|
||||
@ -248,17 +248,22 @@ sub statistics {
|
||||
$Self->{LogObject}
|
||||
->info( 'statistics: Fetched standings are '
|
||||
. Dumper($Standings) );
|
||||
my %ConstructorStandings;
|
||||
my $ConstructorStandingsFormatted = '';
|
||||
my $ConstructorStandingsFormatted = sprintf( "%2s %-15s%7s\n",
|
||||
"#", "Name", "Points" );
|
||||
for my $Constructor ( $Standings->{MRData}->{StandingsTable}
|
||||
->{StandingsLists}->[0]->{ConstructorStandings}->@* )
|
||||
{
|
||||
$ConstructorStandingsFormatted .=
|
||||
"Position: $Constructor->{positionText}, Name: $Constructor->{Constructor}->{name} - Points: $Constructor->{points}\n";
|
||||
$ConstructorStandingsFormatted .= sprintf(
|
||||
"%2d %-15s%7d\n",
|
||||
$Constructor->{positionText},
|
||||
$Constructor->{Constructor}->{name},
|
||||
$Constructor->{points}
|
||||
);
|
||||
}
|
||||
$ConstructorStandingsFormatted =~ s/^/<pre>/;
|
||||
$ConstructorStandingsFormatted =~ s/$/<\/pre>/;
|
||||
$ReturnData{text} = $ConstructorStandingsFormatted;
|
||||
$ReturnData{text} = $ConstructorStandingsFormatted;
|
||||
$ReturnData{parse_mode} = 'HTML';
|
||||
}
|
||||
default {
|
||||
$ReturnData{text} =
|
||||
|
Loading…
Reference in New Issue
Block a user