Skip to content

Commit

Permalink
Use proper JSON booleans (Closes #2)
Browse files Browse the repository at this point in the history
  • Loading branch information
zoffixznet committed May 27, 2015
1 parent 2e5b95c commit 5a5bd04
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions web/lib/P6Project.pm
Expand Up @@ -104,8 +104,18 @@ sub write_html {

sub write_json {
my ($self, $filename) = @_;
my $content = encode_json($self->projects);
return $self->writeout($content, $filename);

my $projects = $self->projects;
for my $mod ( values %$projects ) { # use JSON's true/false values
$mod = +{ %$mod };
$mod->{$_} = $mod->{$_} ? JSON::true : JSON::false
for qw/
badge_has_tests badge_is_fresh badge_panda_nos11
badge_panda badge_is_popular
/;
$mod->{badge_has_readme} //= JSON::false;
}
return $self->writeout(encode_json($projects), $filename);
}

1;

0 comments on commit 5a5bd04

Please sign in to comment.