diff options
author | Yorhel <git@yorhel.nl> | 2009-10-10 17:01:02 +0200 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2009-10-10 17:05:30 +0200 |
commit | 0c5a9606dd9047522c4357e36e5fe9081943b947 (patch) | |
tree | 494e64618856619e9bf0c4ec2d91e9b4b86d3f59 | |
parent | 64007de03cba6c0acb8a2782bc5f86bcad946850 (diff) |
List all known languages on /r and /v/all instead of only those in use
Performance improvement of ~15ms for all release and VN browse pages.
There are in total 20 known languages in the DB, and 12 of them are
actually used (i.e. a release in that language exists). Which means 8 of
the listed language filters won't produce any results (yet), but I'd say
that's an accaptable trade-off.
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | lib/VNDB/DB/Misc.pm | 16 | ||||
-rw-r--r-- | lib/VNDB/Handler/Releases.pm | 2 | ||||
-rw-r--r-- | lib/VNDB/Handler/VNBrowse.pm | 2 |
4 files changed, 4 insertions, 17 deletions
@@ -19,6 +19,7 @@ git - ? - Added producer role (developer/publisher) to releases - Display number of unread posts in "My messages" (instead of total threads) - Optimized dbUserGet (mostly for the user list) + - All languages are listed on /r and /v/all instead of only those in use 2.7 - 2009-09-24 - Improved styling of the threeboxes layout diff --git a/lib/VNDB/DB/Misc.pm b/lib/VNDB/DB/Misc.pm index eeb860b0..ed3730ee 100644 --- a/lib/VNDB/DB/Misc.pm +++ b/lib/VNDB/DB/Misc.pm @@ -6,7 +6,7 @@ use warnings; use Exporter 'import'; our @EXPORT = qw| - dbStats dbRevisionInsert dbItemInsert dbRevisionGet dbItemMod dbLanguages dbRandomQuote + dbStats dbRevisionInsert dbItemInsert dbRevisionGet dbItemMod dbRandomQuote |; @@ -160,20 +160,6 @@ sub dbItemMod { } -# Returns a list of languages actually in use -sub dbLanguages { - my $self = shift; - return [ - map $_->{lang}, @{$self->dbAll(q| - SELECT DISTINCT rl.lang - FROM releases r - JOIN releases_lang rl ON rl.rid = r.latest - WHERE r.hidden = FALSE| - )} - ]; -} - - # Returns a random quote (hashref with keys = vid, quote) sub dbRandomQuote { return $_[0]->dbRow(q| diff --git a/lib/VNDB/Handler/Releases.pm b/lib/VNDB/Handler/Releases.pm index d771d4b1..62776fd2 100644 --- a/lib/VNDB/Handler/Releases.pm +++ b/lib/VNDB/Handler/Releases.pm @@ -635,7 +635,7 @@ sub _filters { txt mt '_rbrowse_languages'; b ' ('.mt('_rbrowse_boolor').')'; end; - for my $i (sort @{$self->dbLanguages}) { + for my $i (@{$self->{languages}}) { span; input type => 'checkbox', name => 'ln', value => $i, id => "lang_$i", grep($_ eq $i, @{$f->{ln}}) ? (checked => 'checked') : (); label for => "lang_$i"; diff --git a/lib/VNDB/Handler/VNBrowse.pm b/lib/VNDB/Handler/VNBrowse.pm index b0c948cd..118a5ee2 100644 --- a/lib/VNDB/Handler/VNBrowse.pm +++ b/lib/VNDB/Handler/VNBrowse.pm @@ -162,7 +162,7 @@ sub _filters { txt mt '_vnbrowse_lang'; b ' ('.mt('_vnbrowse_boolor').')'; end; - for my $i (sort @{$self->dbLanguages}) { + for my $i (@{$self->{languages}}) { span; input type => 'checkbox', name => 'ln', value => $i, id => "lang_$i", (scalar grep $_ eq $i, @{$f->{ln}}) ? (checked => 'checked') : (); |