diff options
author | yorhel <yorhel@1fe2e327-d9db-4752-bcf7-ef0cb4a1748b> | 2008-07-08 07:51:50 +0000 |
---|---|---|
committer | yorhel <yorhel@1fe2e327-d9db-4752-bcf7-ef0cb4a1748b> | 2008-07-08 07:51:50 +0000 |
commit | 079e594bb5a43f948fed01b5140e01f3fd127ff9 (patch) | |
tree | 5d4b0756a03e49b36cd0f2ba44c46a1b0d60980f | |
parent | db47e11b580efa1938de892e6c08ba47ba2c6cc4 (diff) |
Removed the rating system and small cleanup on the homepage
git-svn-id: svn://vndb.org/vndb@55 1fe2e327-d9db-4752-bcf7-ef0cb4a1748b
-rw-r--r-- | data/tpl/home | 25 | ||||
-rw-r--r-- | data/tpl/vnbrowse | 3 | ||||
-rw-r--r-- | data/tpl/vnpage | 4 | ||||
-rw-r--r-- | data/tpl/vnpage_stats | 14 | ||||
-rw-r--r-- | lib/ChangeLog | 1 | ||||
-rw-r--r-- | lib/VNDB/HomePages.pm | 3 | ||||
-rw-r--r-- | lib/VNDB/Util/DB.pm | 4 | ||||
-rw-r--r-- | lib/VNDB/VN.pm | 13 | ||||
-rw-r--r-- | util/updates/update_1.19.sql | 6 |
9 files changed, 25 insertions, 48 deletions
diff --git a/data/tpl/home b/data/tpl/home index 5ea730ce..b07e6e11 100644 --- a/data/tpl/home +++ b/data/tpl/home @@ -14,7 +14,7 @@ </p> <h3 class="home">[[: $d{an}{title} ]]- - <p class="actions">by <a href="/u[[= $d{anpost}{uid} ]]">[[: $d{anpost}{username} ]]</a>, -[[= age $d{anpost}{date} ]]</p></h3> + <p class="actions">[[= age $d{anpost}{date} ]]</p></h3> <p class="desc"> [[= summary $d{anpost}{msg}, 200 ]] <br /> @@ -29,20 +29,6 @@ </ul> <ul class="home"> - <li><b>Recent votes</b></li> - [[ for (@{$d{recentvotes}}) { ]]- - <li><a href="/v[[= $_->{vid} ]]" title="[[: $_->{title} ]]">[[: shorten $_->{title}, 30 ]]</a> ([[= $_->{vote} ]])</li> - [[ } ]] -</ul> - -<ul class="home"> - <li><b>Most popular</b></li> - [[ for (@{$d{popular}}) { $_->{c_votes} =~ s#^([0-9]{2}.[0-9]{2}).+$#sprintf '%.1f', $1#e; ]]- - <li><a href="/v[[= $_->{id} ]]" title="[[: $_->{title} ]]">[[: shorten $_->{title}, 30 ]]</a> ([[= $_->{c_votes} ]])</li> - [[ } ]] -</ul> - -<ul class="home break"> <li><b>Recently added visual novels</b></li> [[ for (@{$d{recentvns}}) { ]]- <li><a href="/v[[= $_->{iid} ]]" title="[[: $_->{ititle} ]]">[[: shorten $_->{ititle}, 30 ]]</a></li> @@ -55,12 +41,3 @@ <li><a href="/p[[= $_->{iid} ]]" title="[[: $_->{ititle} ]]">[[: shorten $_->{ititle}, 30 ]]</a></li> [[ } ]]- </ul> - -<ul class="home"> - <li><b>Random visual novels</b></li> - [[ for (@{$d{randomvns}}) { ]]- - <li><a href="/v[[= $_->{id} ]]" title="[[: $_->{title} ]]">[[: shorten $_->{title}, 30 ]]</a></li> - [[ } ]]- -</ul> - - diff --git a/data/tpl/vnbrowse b/data/tpl/vnbrowse index 42514bcd..f03d74d1 100644 --- a/data/tpl/vnbrowse +++ b/data/tpl/vnbrowse @@ -88,10 +88,8 @@ <td class="tc2"> </td> <td class="tc3"> </td> <td class="tc4">Released [[= sortbut($url, 'released') ]]</td> - <td class="tc5">Rating [[= sortbut($url, 'votes') ]]</td> </tr></thead> [[ for (@{$d{vn}}) { - $_->{c_votes} =~ s#^([0-9]{2}.[0-9]{2})\|([0-9]{4})$#$1 == 0 ? sprintf '- (%d)', $2 : sprintf '%.2f (%d)', $1, $2#e; $_->{c_released} =~ s#^([0-9]{4})([0-9]{2}).+#$1==0?'N/A':$1==9999?'TBA':(($2&&$2<13?($Time::CTime::MoY[$2-1].' '):'').$1)#e; $_->{c_platforms} = join '', map { $_ ne 'oth' ? '<acronym class="icons '.$_.'" title="'._hchar($VNDB::PLAT->{$_}).'"> </acronym>' : () @@ -103,7 +101,6 @@ <td class="tc2">[[= $_->{c_platforms} ]]</td> <td class="tc3">[[= $_->{c_languages} ]]</td> <td class="tc4">[[: $_->{c_released} ]]</td> - <td class="tc5">[[: $_->{c_votes} ]]</td> </tr> [[ } ]]- </table> diff --git a/data/tpl/vnpage b/data/tpl/vnpage index 551731a5..19061249 100644 --- a/data/tpl/vnpage +++ b/data/tpl/vnpage @@ -65,9 +65,6 @@ </div> -[[ - $d{vn}{c_votes} =~ s#^([0-9]{2}.[0-9]{2})\|([0-9]{4})$#$2 == 0 ? 'No votes yet' : - $1 == 0 ? sprintf 'N/A (%d vote%s)', $2, $2>1?'s':'' : sprintf '%.2f (%d vote%s)', $1, $2, $2>1?'s':''#e; - my @links = ( $d{vn}{l_wp} ? [ 'Wikipedia', 'http://en.wikipedia.org/wiki/%s', $d{vn}{l_wp} ] : (), $d{vn}{l_encubed} ? [ 'Encubed', 'http://novelnews.net/tag/%s/', _huri $d{vn}{l_encubed} ] : (), @@ -86,7 +83,6 @@ if($d{vn}{length} || $d{vn}{alias} || @links || $prod) { ]] <dt>Aliases</dt><dd>[[: $d{vn}{alias} ]]</dd>[[ } ]]- [[ if(@links > 0) { ]]- <dt>Links</dt><dd>[[= join(', ', map { '<a href="'.sprintf($_->[1],$_->[2]).'">'.$_->[0].'</a>' } @links) ]]</dd>[[ } ]]- - <dt>Rating</dt><dd>[[: $d{vn}{c_votes} ]]</dd> [[ if($prod) { ]]- <dt>Producers</dt><dd> [[ for my $l (@lang) { my %l; diff --git a/data/tpl/vnpage_stats b/data/tpl/vnpage_stats index 7108486e..d5d002a7 100644 --- a/data/tpl/vnpage_stats +++ b/data/tpl/vnpage_stats @@ -1,13 +1,17 @@ <ul id="stats"> + [[ my $max = 1; my $total = 0; my $sum = 0; - for (0..$#{$d{votes}{graph}}) { - $total += $d{votes}{graph}[$_]; - $max = $d{votes}{graph}[$_] if $d{votes}{graph}[$_] > $max; - $sum += ($_+1) * $d{votes}{graph}[$_]; + + if($d{votes}{graph}) { + for (0..$#{$d{votes}{graph}}) { + $total += $d{votes}{graph}[$_]; + $max = $d{votes}{graph}[$_] if $d{votes}{graph}[$_] > $max; + $sum += ($_+1) * $d{votes}{graph}[$_]; + } } ]] -[[ if(!$d{user} || ($d{pv} && $d{user}{votes})) { ]]- +[[ if($d{votes}{graph} && $d{pv} && $d{user}{votes}) { ]]- <li><h3>Vote graph <p class="actions">[[= $total ]]- vote[[= $total==1?'':'s' ]]- total [[= $total ? sprintf(', average: %.1f.', $sum/$total) : '' ]]</p></h3> <table id="tvg"> diff --git a/lib/ChangeLog b/lib/ChangeLog index 0a39be9a..a37bce7f 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -10,6 +10,7 @@ TODO: - Integrated discussion board - Colored diff for alies field - 'ttabs' for user entries + - Removed the rating system 1.18 - 2008-07-02 (r51) - Releases, producers and visual novel items can't be fully deleted anymore diff --git a/lib/VNDB/HomePages.pm b/lib/VNDB/HomePages.pm index 7a70797a..1db0fbe4 100644 --- a/lib/VNDB/HomePages.pm +++ b/lib/VNDB/HomePages.pm @@ -20,9 +20,6 @@ sub HomePage { recentedits => scalar $self->DBGetHist( results => 10, what => 'iid ititle'), recentvns => scalar $self->DBGetHist( results => 10, what => 'iid ititle', edits => 0, type => 'v'), recentps => scalar $self->DBGetHist( results => 10, what => 'iid ititle', edits => 0, type => 'p'), - randomvns => scalar $self->DBGetVN( results => 10, order => 'RANDOM()'), - recentvotes => scalar $self->DBGetVotes(results => 10, hide => 1), - popular => scalar $self->DBGetVN( results => 10, order => 'v.c_votes DESC'), }); } diff --git a/lib/VNDB/Util/DB.pm b/lib/VNDB/Util/DB.pm index 8391f58f..679c16b6 100644 --- a/lib/VNDB/Util/DB.pm +++ b/lib/VNDB/Util/DB.pm @@ -428,7 +428,6 @@ sub DBAddVote { # vid, uid, vote $_[1], $_[2], $_[3], time ); # XXX: performance improvement: let a cron job handle this - $_[0]->DBExec('SELECT calculate_rating()'); } @@ -438,7 +437,6 @@ sub DBDelVote { # uid, vid # uid = 0 to delete all DELETE FROM votes WHERE %s vid = %d|, $uid, $_[2]); - $_[0]->DBExec('SELECT calculate_rating()'); } @@ -617,7 +615,7 @@ sub DBGetVN { # %options->{ id rev char search order results page what cati cate 'JOIN users u ON u.id = c.requester' ) : (), ); - my $sel = 'v.id, v.locked, v.hidden, v.c_released, v.c_languages, v.c_votes, v.c_platforms, vr.title, vr.id AS cid, v.rgraph'; + my $sel = 'v.id, v.locked, v.hidden, v.c_released, v.c_languages, v.c_platforms, vr.title, vr.id AS cid, v.rgraph'; $sel .= ', vr.alias, vr.image AS image, vr.img_nsfw, vr.length, vr.desc, vr.l_wp, vr.l_encubed, vr.l_renai, vr.l_vnn' if $o{what} =~ /extended/; $sel .= ', c.added, c.requester, c.comments, v.latest, u.username, c.rev, c.causedby' if $o{what} =~ /changes/; diff --git a/lib/VNDB/VN.pm b/lib/VNDB/VN.pm index 365204d4..683aba67 100644 --- a/lib/VNDB/VN.pm +++ b/lib/VNDB/VN.pm @@ -49,10 +49,10 @@ sub VNPage { latest => scalar $self->DBGetVNList(vid => $id, results => 7, hide => 1), graph => $self->DBVNListStats(vid => $id), }, - votes => { - latest => scalar $self->DBGetVotes(vid => $id, results => 10, hide => 1), - graph => $self->DBVoteStats(vid => $id), - }, + #votes => { + # latest => scalar $self->DBGetVotes(vid => $id, results => 10, hide => 1), + # graph => $self->DBVoteStats(vid => $id), + #}, ) : (), }); } @@ -212,12 +212,13 @@ sub VNBrowse { $chr = 'all' if !defined $chr; my $f = $self->FormCheck( - { name => 's', required => 0, default => 'title', enum => [ qw|title released votes| ] }, + { name => 's', required => 0, default => 'title', enum => [ qw|title released| ] }, { name => 'o', required => 0, default => 'a', enum => [ 'a','d' ] }, { name => 'q', required => 0, default => '' }, { name => 'sq', required => 0, default => '' }, { name => 'p', required => 0, template => 'int', default => 1}, ); + $f->{s} = 'title' if $f->{_err}; $f->{q} ||= $f->{sq}; @@ -257,7 +258,7 @@ sub VNBrowse { @plat ? ( platform => \@plat ) : (), results => 50, page => $f->{p}, - order => {title => 'vr.title', released => 'v.c_released', votes => 'v.c_votes' + order => {title => 'vr.title', released => 'v.c_released', }->{$f->{s}}.{a=>' ASC',d=>' DESC'}->{$f->{o}}, )) : ([], 0); diff --git a/util/updates/update_1.19.sql b/util/updates/update_1.19.sql index 4b5a08b5..225cddfb 100644 --- a/util/updates/update_1.19.sql +++ b/util/updates/update_1.19.sql @@ -26,3 +26,9 @@ CREATE TABLE threads_posts ( PRIMARY KEY(tid, num) ) WITHOUT OIDS; + + +-- Remove the rating/ranking system +ALTER TABLE vn DROP COLUMN c_votes; +DROP FUNCTION calculate_rating(); + |