Skip to content

Commit

Permalink
fixing problem with multiple tags without documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
matyaskopp committed Feb 23, 2017
1 parent e406dcc commit 1536648
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/PMLTQ/Server/Schema/Result/Treebank.pm
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ Returns documentation for treebank or joined documentation for all its tags
sub get_documentation {
my $self = shift;

return $self->documentation || join("\n\n",map {$_->documentation} $self->tags()->all);
return $self->documentation || join("\n\n",map {$_->documentation} grep {$_->documentation} $self->tags()->all);
}

=head2 list_data
Expand Down
12 changes: 12 additions & 0 deletions t/api_treebank.t
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ my $tu = test_user();
my $tb = test_treebank();
my $tg1 = test_tag('TAG1','TAG1DOC');
my $tg2 = test_tag('TAG2','TAG2DOC');
my $tg1nodoc = test_tag('TAG1NODOC');
my $tg2nodoc = test_tag('TAG2NODOC');

# Test model

Expand Down Expand Up @@ -201,5 +203,15 @@ $t->get_ok($treebank_url)

is($t->tx->res->json->{documentation}, $tb->documentation, 'Treebank uses treebank documentation');

# test two tags without doc and treebank without doc
$tb->documentation('');
$tb->set_tags([$tg1nodoc,$tg2nodoc]);
$tb->update();

$t->get_ok($treebank_url)
->status_is(200);

is($t->tx->res->json->{documentation}, '', 'Treebank does not have documentation');


done_testing();

0 comments on commit 1536648

Please sign in to comment.