File tree 2 files changed +13
-12
lines changed
2 files changed +13
-12
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ use List::UtilsBy qw( partition_by );
3
3
use Moose::Role;
4
4
use namespace::autoclean;
5
5
6
- use MusicBrainz::Server::Entity::Util::JSON qw( to_json_object ) ;
6
+ use MusicBrainz::Server::Entity::Util::JSON qw( to_json_array ) ;
7
7
use MusicBrainz::Server::Translation ' l' ;
8
8
9
9
sub edit_category { l(' Work' ) }
@@ -21,16 +21,21 @@ sub grouped_attributes_by_type {
21
21
grep { $_ } map { $_ -> {attribute_value_id } } @$attributes
22
22
);
23
23
24
- return partition_by { $_ -> type-> l_name } map {
25
- my $attr = MusicBrainz::Server::Entity::WorkAttribute-> new(
24
+ my %partitioned_attributes = partition_by { $_ -> type-> l_name } map {
25
+ MusicBrainz::Server::Entity::WorkAttribute-> new(
26
26
id => $_ -> {id },
27
27
type_id => $_ -> {attribute_type_id },
28
28
type => $attribute_types -> {$_ -> {attribute_type_id }},
29
29
value => $_ -> {attribute_text } // $attribute_values -> {$_ -> {attribute_value_id }}-> value,
30
30
value_id => $_ -> {attribute_value_id }
31
31
);
32
- $to_json ? to_json_object($attr ) : $attr ;
33
32
} @$attributes ;
33
+
34
+ if ($to_json ) {
35
+ %partitioned_attributes = map { $_ => to_json_array($partitioned_attributes {$_ }) } keys %partitioned_attributes ;
36
+ }
37
+
38
+ return %partitioned_attributes ;
34
39
}
35
40
36
41
1;
Original file line number Diff line number Diff line change @@ -4,15 +4,11 @@ use Moose;
4
4
with ' MusicBrainz::Server::Report::ReleaseReport' ,
5
5
' MusicBrainz::Server::Report::FilterForEditor::ReleaseID' ;
6
6
7
- around inflate_rows => sub {
8
- my $orig = shift ;
9
- my $self = shift ;
7
+ after _load_extra_release_info => sub {
8
+ my ($self , @releases ) = @_ ;
10
9
11
- my $rows = $self -> $orig (@_ );
12
- $self -> c-> model(' Language' )-> load(map { $_ -> {release } } @$rows );
13
- $self -> c-> model(' Script' )-> load(map { $_ -> {release } } @$rows );
14
-
15
- return $rows ;
10
+ $self -> c-> model(' Language' )-> load(@releases );
11
+ $self -> c-> model(' Script' )-> load(@releases );
16
12
};
17
13
18
14
sub query {
You can’t perform that action at this time.
0 commit comments