diff options
author | Zarino Zappia <mail@zarino.co.uk> | 2016-03-01 18:31:06 +0000 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2016-03-11 15:05:48 +0000 |
commit | e17eb20dbcca1f0087387f8137448902824a607e (patch) | |
tree | 9dd7d78d45153ad019803f62666e51128277e7fe /perllib/FixMyStreet/Cobrand/FixMyStreet.pm | |
parent | 05ddbe3874afd0ca12f397fcce6f077148adc75e (diff) |
[fixmystreet.com] Friendly A/B test setup.
Includes a smiley, bright yellow homepage, and updated nav bar and
footer across the entire site; a few content changes; request for
gender information from users.
Fixes #1341.
Diffstat (limited to 'perllib/FixMyStreet/Cobrand/FixMyStreet.pm')
-rw-r--r-- | perllib/FixMyStreet/Cobrand/FixMyStreet.pm | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/Cobrand/FixMyStreet.pm b/perllib/FixMyStreet/Cobrand/FixMyStreet.pm index f21d38ff8..159f2f5db 100644 --- a/perllib/FixMyStreet/Cobrand/FixMyStreet.pm +++ b/perllib/FixMyStreet/Cobrand/FixMyStreet.pm @@ -59,5 +59,26 @@ sub get_country_for_ip_address { return mySociety::Gaze::get_country_from_ip($ip); } +sub report_form_extras { + ( { name => 'gender', required => 0 }, { name => 'variant', required => 0 } ) +} + +sub ask_gender_question { + my $self = shift; + + return 1 unless $self->{c}->user; + + my $reports = $self->{c}->model('DB::Problem')->search({ + user_id => $self->{c}->user->id, + extra => { like => '%gender%' } + }, { order_by => { -desc => 'id' } }); + + while (my $report = $reports->next) { + my $gender = $report->get_extra_metadata('gender'); + return 0 if $gender =~ /female|male|other|unknown/; + } + return 1; +} + 1; |