diff options
author | Yorhel <git@yorhel.nl> | 2009-11-27 11:31:40 +0100 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2009-11-27 11:31:40 +0100 |
commit | 4b6421198ab810375b6d152f0eb581a01c1017b5 (patch) | |
tree | 9bf004947aed339bf0eee58964e754ccb8176da6 /lib | |
parent | 8448e6a074a5b5899db99567b625506fc57689c9 (diff) |
Changed VN score on tags pages to display plain averages
For three reasons:
- Speed
tag_vn_calc() is now more than 10 times faster (granted, it could
have been a lot faster even with the bayesian rating, but whatever)
- Consistency with the tag scores displayed on the VN pages (which are
raw averages as well)
- It didn't always make sense
Diffstat (limited to 'lib')
-rw-r--r-- | lib/VNDB/DB/Tags.pm | 10 | ||||
-rw-r--r-- | lib/VNDB/DB/VN.pm | 6 | ||||
-rw-r--r-- | lib/VNDB/Handler/Tags.pm | 2 |
3 files changed, 9 insertions, 9 deletions
diff --git a/lib/VNDB/DB/Tags.pm b/lib/VNDB/DB/Tags.pm index 8cf4ee29..16b39a5b 100644 --- a/lib/VNDB/DB/Tags.pm +++ b/lib/VNDB/DB/Tags.pm @@ -200,21 +200,21 @@ sub dbTagStats { # Argument: %options->{ tag order page results maxspoil } sub dbTagVNs { my($self, %o) = @_; - $o{order} ||= 'tb.rating DESC'; + $o{order} ||= 'th.rating DESC'; $o{page} ||= 1; $o{results} ||= 10; my %where = ( 'tag = ?' => $o{tag}, defined $o{maxspoil} ? ( - 'tb.spoiler <= ?' => $o{maxspoil} ) : (), + 'th.spoiler <= ?' => $o{maxspoil} ) : (), 'v.hidden = FALSE' => 1, ); my($r, $np) = $self->dbPage(\%o, q| - SELECT tb.tag, tb.vid, tb.users, tb.rating, tb.spoiler, vr.title, vr.original, v.c_languages, v.c_released, v.c_platforms, v.c_popularity - FROM tags_vn_bayesian tb - JOIN vn v ON v.id = tb.vid + SELECT th.tag, th.vid, th.users, th.rating, th.spoiler, vr.title, vr.original, v.c_languages, v.c_released, v.c_platforms, v.c_popularity + FROM tags_vn_inherit th + JOIN vn v ON v.id = th.vid JOIN vn_rev vr ON vr.id = v.latest !W ORDER BY !s|, diff --git a/lib/VNDB/DB/VN.pm b/lib/VNDB/DB/VN.pm index 250f5267..55df48ee 100644 --- a/lib/VNDB/DB/VN.pm +++ b/lib/VNDB/DB/VN.pm @@ -33,11 +33,11 @@ sub dbVNGet { $o{platform} && @{$o{platform}} ? ( '('.join(' OR ', map "v.c_platforms ILIKE '%%$_%%'", @{$o{platform}}).')' => 1 ) : (), $o{tags_include} && @{$o{tags_include}} ? ( - 'v.id IN(SELECT vid FROM tags_vn_bayesian WHERE tag IN(!l) AND spoiler <= ? GROUP BY vid HAVING COUNT(tag) = ?)', + 'v.id IN(SELECT vid FROM tags_vn_inherit WHERE tag IN(!l) AND spoiler <= ? GROUP BY vid HAVING COUNT(tag) = ?)', [ $o{tags_include}[1], $o{tags_include}[0], $#{$o{tags_include}[1]}+1 ] ) : (), $o{tags_exclude} && @{$o{tags_exclude}} ? ( - 'v.id NOT IN(SELECT vid FROM tags_vn_bayesian WHERE tag IN(!l))' => [ $o{tags_exclude} ] ) : (), + 'v.id NOT IN(SELECT vid FROM tags_vn_inherit WHERE tag IN(!l))' => [ $o{tags_exclude} ] ) : (), # don't fetch hidden items unless we ask for an ID !$o{id} && !$o{rev} ? ( 'v.hidden = FALSE' => 0 ) : (), @@ -94,7 +94,7 @@ sub dbVNGet { '(SELECT COUNT(*)+1 FROM vn iv WHERE iv.hidden = false AND iv.c_rating > v.c_rating) AS r_ranking', ) : (), $tag_ids ? - qq|(SELECT AVG(tvb.rating) FROM tags_vn_bayesian tvb WHERE tvb.tag IN($tag_ids) AND tvb.vid = v.id AND spoiler <= $o{tags_include}[0] GROUP BY tvb.vid) AS tagscore| : (), + qq|(SELECT AVG(tvh.rating) FROM tags_vn_inherit tvh WHERE tvh.tag IN($tag_ids) AND tvh.vid = v.id AND spoiler <= $o{tags_include}[0] GROUP BY tvh.vid) AS tagscore| : (), ); my($r, $np) = $self->dbPage(\%o, q| diff --git a/lib/VNDB/Handler/Tags.pm b/lib/VNDB/Handler/Tags.pm index b28ba97a..8461fb7c 100644 --- a/lib/VNDB/Handler/Tags.pm +++ b/lib/VNDB/Handler/Tags.pm @@ -40,7 +40,7 @@ sub tagpage { my($list, $np) = $t->{meta} || $t->{state} != 2 ? ([],0) : $self->dbTagVNs( tag => $tag, - order => {score=>'tb.rating',title=>'vr.title',rel=>'v.c_released',pop=>'v.c_popularity'}->{$f->{s}}.($f->{o}eq'a'?' ASC':' DESC'), + order => {score=>'th.rating',title=>'vr.title',rel=>'v.c_released',pop=>'v.c_popularity'}->{$f->{s}}.($f->{o}eq'a'?' ASC':' DESC').($f->{s}eq'score'?', th.users DESC':''), page => $f->{p}, results => 50, maxspoil => $f->{m}, |