aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/Cobrand/FixaMinGata.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/FixMyStreet/Cobrand/FixaMinGata.pm')
-rw-r--r--perllib/FixMyStreet/Cobrand/FixaMinGata.pm77
1 files changed, 66 insertions, 11 deletions
diff --git a/perllib/FixMyStreet/Cobrand/FixaMinGata.pm b/perllib/FixMyStreet/Cobrand/FixaMinGata.pm
index 07a4ef920..e84e4cf55 100644
--- a/perllib/FixMyStreet/Cobrand/FixaMinGata.pm
+++ b/perllib/FixMyStreet/Cobrand/FixaMinGata.pm
@@ -3,10 +3,10 @@ use base 'FixMyStreet::Cobrand::Default';
use strict;
use warnings;
+use utf8;
use Carp;
use mySociety::MaPit;
-use FixMyStreet::Geocode::FixaMinGata;
use DateTime;
sub country {
@@ -23,10 +23,66 @@ sub enter_postcode_text {
# Is also adding language parameter
sub disambiguate_location {
- return {
+ my $self = shift;
+ my $string = shift;
+
+ my $out = {
+ %{ $self->SUPER::disambiguate_location() },
lang => 'sv',
- country => 'se', # Is this the right format? /Rikard
+ country => 'se',
};
+
+ $string = lc($string);
+
+ if ($string eq 'lysekil') {
+ # Lysekil
+ $out->{bounds} = [ '58.4772', '11.3983', '58.1989', '11.5755' ];
+ } elsif ($string eq 'tjörn') {
+ # Tjörn
+ $out->{bounds} = [ '58.0746', '11.4429', '57.9280', '11.7815' ];
+ } elsif ($string eq 'varmdö') {
+ # Varmdö
+ $out->{bounds} = [ '59.4437', '18.3513', '59.1907', '18.7688' ];
+ } elsif ($string eq 'öckerö') {
+ # Öckerö
+ $out->{bounds} = [ '57.7985', '11.5792', '57.6265', '11.7108' ];
+ }
+
+ return $out;
+}
+
+sub geocoder_munge_results {
+ my ($self, $result) = @_;
+
+ if ($result->{osm_id} == 1076755) { # Hammarö, Hammarö, Värmlands län, Svealand, Sweden
+ $result->{lat} = 59.3090;
+ $result->{lon} = 13.5297;
+ }
+
+ if ($result->{osm_id} == 398625) { # Haninge, Landskapet Södermanland, Stockholms län, Svealand, Sweden
+ $result->{lat} = 59.1069;
+ $result->{lon} = 18.2085;
+ }
+
+ if ($result->{osm_id} == 5831132) { # Nordmaling District, Nordmaling, Ångermanland, Västerbottens län, Norrland, 91433, Sweden
+ $result->{lat} = 63.5690;
+ $result->{lon} = 19.5028;
+ }
+
+ if ($result->{osm_id} == 935430) { # Sotenäs, Västra Götalands län, Götaland, Sweden
+ $result->{lat} = 58.4219;
+ $result->{lon} = 11.3345;
+ }
+
+ if ($result->{osm_id} == 935640) { # Tanum, Västra Götalands län, Götaland, Sweden
+ $result->{lat} = 58.7226;
+ $result->{lon} = 11.3242;
+ }
+
+ if ($result->{osm_id} == 289344) { # Älvkarleby, Landskapet Uppland, Uppsala län, Svealand, Sweden
+ $result->{lat} = 60.5849;
+ $result->{lon} = 17.4545;
+ }
}
sub area_types {
@@ -37,11 +93,9 @@ sub area_types {
sub geocode_postcode {
my ( $self, $s ) = @_;
- # Most people write Swedish postcodes like this:
- #+ XXX XX, so let's remove the space
- # Is this the right place to do this? //Rikard
- # This is the right place! // Jonas
- $s =~ s/\ //g; # Rikard, remove space in postcode
+ # Most people write Swedish postcodes like this:
+ # XXX XX, so let's remove the space
+ $s =~ s/\ //g;
if ($s =~ /^\d{5}$/) {
my $location = mySociety::MaPit::call('postcode', $s);
if ($location->{error}) {
@@ -108,12 +162,13 @@ sub filter_all_council_ids_list {
return @all_councils_ids; # Är detta rätt? //Rikard
}
-# The pin is green is it's fixed, yellow if it's closed (but not fixed), and
-# red otherwise.
+# The pin is green is it's fixed or closed, yellow if it's in progress (not in a
+# confirmed state), and red otherwise.
sub pin_colour {
my ( $self, $p, $context ) = @_;
+ return 'green' if $p->is_closed;
return 'green' if $p->is_fixed;
- return 'yellow' if $p->is_closed;
+ return 'yellow' if $p->is_in_progress;
return 'red';
}