summaryrefslogtreecommitdiff
path: root/lib/VNWeb/TT/TagPage.pm
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2022-01-20 09:02:15 +0100
committerYorhel <git@yorhel.nl>2022-02-08 11:36:07 +0100
commit727a4d84255f13badffe16c5858fdb036ddcdbce (patch)
tree6c77f72e2423a7c7425caea6aebc6ba8eaf001f8 /lib/VNWeb/TT/TagPage.pm
parent9d651b8d138349b3853f23117cc3802fcfe0ba6a (diff)
VN: Add support for multiple titles in different languages
This implements the main database model part of custom title languages (https://vndb.org/t12465). Selecting the right title for display is done in SQL through the 'vnt' VIEW, which can be overridden in each session with a TEMPORARY VIEW in order to support user title preferences, but that part has not been implemented yet. I had started out using an sql_vn() function that returned a subquery instead of using a VIEW, but then ran into trouble with the item_info() SQL function. This VIEW approach also happened to simplify much of the code. I did have to get rid of the Discusssions::Lib::sql_boards() function, as Postgres was unable to optimize the subquery inside a UNION inside a subquery for some reason. Haven't run into any other noticeable performance regressions yet. TODO: - Implement actual user title preferences - Add the correct 'lang' HTML attributes everywhere a title is displayed (we do have the information now, though it still isn't trivial) - Add title fetching support to API
Diffstat (limited to 'lib/VNWeb/TT/TagPage.pm')
-rw-r--r--lib/VNWeb/TT/TagPage.pm4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/VNWeb/TT/TagPage.pm b/lib/VNWeb/TT/TagPage.pm
index 0a5fa903..7863ac12 100644
--- a/lib/VNWeb/TT/TagPage.pm
+++ b/lib/VNWeb/TT/TagPage.pm
@@ -102,9 +102,9 @@ sub vns_ {
db_maytimeout {
$count = tuwf->dbVali('SELECT count(*) FROM vn v JOIN tags_vn_inherit tvi ON tvi.vid = v.id WHERE', $where);
$list = $count ? tuwf->dbPagei({results => $opt->{s}->results(), page => $opt->{p}}, '
- SELECT tvi.rating AS tagscore, v.id, v.title, v.original, v.c_released, v.c_popularity, v.c_votecount, v.c_rating, v.c_average
+ SELECT tvi.rating AS tagscore, v.id, v.title, v.alttitle, v.c_released, v.c_popularity, v.c_votecount, v.c_rating, v.c_average
, v.image, v.c_platforms::text[] AS platforms, v.c_languages::text[] AS lang
- FROM vn v
+ FROM vnt v
JOIN tags_vn_inherit tvi ON tvi.vid = v.id
WHERE', $where, '
ORDER BY', $opt->{s}->sql_order(),