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