blob: 7521b4f08debd2703f59ba257085a143250a984c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
package VNWeb::TT::Lib;
use VNWeb::Prelude;
use Exporter 'import';
our @EXPORT = qw/ tagscore_ enrich_group /;
sub tagscore_ {
my($s, $ign) = @_;
div_ mkclass(tagscore => 1, negative => $s < 0, ignored => $ign), sub {
span_ sprintf '%.1f', $s;
div_ style => sprintf('width: %.0fpx', abs $s/3*30), '';
};
}
# Add a 'group' name for traits
sub enrich_group {
my($type, @lst) = @_;
enrich_merge id => 'SELECT t.id, g.name AS "group" FROM traits t JOIN traits g ON g.id = t."group" WHERE t.id IN', @lst if $type eq 'i';
}
1;
|