line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Slovo::Model::Products; |
2
|
3
|
|
|
3
|
|
1179
|
use Mojo::Base 'Slovo::Model', -signatures; |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
17
|
|
3
|
3
|
|
|
3
|
|
569
|
use Slovo::Model::Celini; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
18
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
my $table = 'products'; |
6
|
|
|
|
|
|
|
has table => $table; |
7
|
|
|
|
|
|
|
my $ctable = Slovo::Model::Celini->table; |
8
|
|
|
|
|
|
|
|
9
|
0
|
|
|
0
|
0
|
0
|
sub add ($m, $row) { |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
10
|
0
|
|
0
|
|
|
0
|
$row->{tstamp} //= time - 1; |
11
|
0
|
|
0
|
|
|
0
|
$row->{created_at} //= $row->{tstamp}; |
12
|
0
|
|
|
|
|
0
|
$m->c->debug($row); |
13
|
0
|
|
|
|
|
0
|
return $m->next::method($row); |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# select "books" with the same celina.pid except the book with the current |
17
|
|
|
|
|
|
|
# celina.id |
18
|
4
|
|
|
4
|
0
|
12352
|
sub others ($m, $celina) { |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
8
|
|
19
|
|
|
|
|
|
|
return $m->all({ |
20
|
|
|
|
|
|
|
table => [$ctable, $table], |
21
|
|
|
|
|
|
|
columns => "$ctable.language,$table.title,$table.properties,$table.alias", |
22
|
|
|
|
|
|
|
where => { |
23
|
|
|
|
|
|
|
"$ctable.id" => {'!=' => $celina->{id}}, |
24
|
|
|
|
|
|
|
language => {'=' => $celina->{language}}, |
25
|
|
|
|
|
|
|
pid => $celina->{pid}, |
26
|
|
|
|
|
|
|
p_type => $celina->{data_type}, |
27
|
|
|
|
|
|
|
published => {'>' => 1}, |
28
|
|
|
|
|
|
|
"$table.alias" => {'=' => \"$ctable.alias"}, |
29
|
|
|
|
|
|
|
properties => {-like => '%"images"%'} #only variants which have images |
30
|
|
|
|
|
|
|
}, |
31
|
|
|
|
|
|
|
limit => 35 |
32
|
|
|
|
|
|
|
})->each(sub { |
33
|
4
|
|
|
4
|
|
13695
|
$_->{properties} = Mojo::JSON::from_json($_->{properties}); |
34
|
4
|
|
|
|
|
99
|
}); |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
1; |