parent
dc15d8cb83
commit
5121d7536f
|
@ -10,7 +10,7 @@ use Try::Tiny;
|
||||||
zci answer_type => "sun_info";
|
zci answer_type => "sun_info";
|
||||||
zci is_cached => 0;
|
zci is_cached => 0;
|
||||||
|
|
||||||
triggers start => 'sunrise', 'sunset';
|
triggers start => 'sunrise', 'sunset', 'what time is sunset', 'what time is sunrise';
|
||||||
|
|
||||||
primary_example_queries 'sunrise', 'sunset';
|
primary_example_queries 'sunrise', 'sunset';
|
||||||
secondary_example_queries 'sunrise for aug 30', 'sunset on 2015-01-01';
|
secondary_example_queries 'sunrise for aug 30', 'sunset on 2015-01-01';
|
||||||
|
@ -25,7 +25,8 @@ my $datestring_regex = datestring_regex();
|
||||||
|
|
||||||
handle remainder => sub {
|
handle remainder => sub {
|
||||||
|
|
||||||
my $remainder = shift;
|
my $remainder = shift // '';
|
||||||
|
$remainder =~ s/\?//g; # Strip question marks.
|
||||||
my ($lat, $lon, $tz) = ($loc->latitude, $loc->longitude, $loc->time_zone);
|
my ($lat, $lon, $tz) = ($loc->latitude, $loc->longitude, $loc->time_zone);
|
||||||
my $where = join(', ', grep { defined $_ } ($loc->city, $loc->region_name, $loc->country_name));
|
my $where = join(', ', grep { defined $_ } ($loc->city, $loc->region_name, $loc->country_name));
|
||||||
return unless (($lat || $lon) && $tz && $where); # We'll need a real location and time zone.
|
return unless (($lat || $lon) && $tz && $where); # We'll need a real location and time zone.
|
||||||
|
|
10
t/SunInfo.t
10
t/SunInfo.t
|
@ -21,13 +21,19 @@ ddg_goodie_test([qw(
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
'sunrise' => test_zci(@now),
|
'sunrise' => test_zci(@now),
|
||||||
|
'what time is sunrise' => test_zci(@now),
|
||||||
'sunset' => test_zci(@now),
|
'sunset' => test_zci(@now),
|
||||||
|
'what time is sunset' => test_zci(@now),
|
||||||
'sunrise for aug 30' => test_zci(@aug),
|
'sunrise for aug 30' => test_zci(@aug),
|
||||||
'sunset for aug 30' => test_zci(@aug),
|
'sunset for aug 30?' => test_zci(@aug),
|
||||||
'sunset on 2015-01-01' => test_zci(@exact),
|
'sunset on 2015-01-01' => test_zci(@exact),
|
||||||
'sunrise on 2015-01-01' => test_zci(@exact),
|
'what time is sunrise on 2015-01-01?' => test_zci(@exact),
|
||||||
'sunset for pilly' => undef,
|
'sunset for pilly' => undef,
|
||||||
'sunrise on mars' => undef,
|
'sunrise on mars' => undef,
|
||||||
|
'sunset boulevard' => undef,
|
||||||
|
'tequila sunrise' => undef,
|
||||||
|
'sunrise mall' => undef,
|
||||||
|
'after the sunset' => undef,
|
||||||
);
|
);
|
||||||
|
|
||||||
done_testing;
|
done_testing;
|
||||||
|
|
Loading…
Reference in New Issue