summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2020-09-15 08:39:54 +0200
committerYorhel <git@yorhel.nl>2020-09-15 08:39:59 +0200
commit58030654f5ac4298be3080bb8f74335a4b73a5fd (patch)
treeb5a4800ada843cd41a8851b4c7b6312c5bf317a5
parentb107098a6bed6e8fd7e2328d2f5245c94c8ffada (diff)
HomePage: Discard date filters in upcoming/just released boxes
And honor saved filters in the links to the full listings.
-rw-r--r--lib/VNWeb/Misc/HomePage.pm10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/VNWeb/Misc/HomePage.pm b/lib/VNWeb/Misc/HomePage.pm
index 93a41434..612cfa04 100644
--- a/lib/VNWeb/Misc/HomePage.pm
+++ b/lib/VNWeb/Misc/HomePage.pm
@@ -133,21 +133,23 @@ sub random_vns_ {
sub releases_ {
my($released) = @_;
- # XXX This query is kinda slow, an index on releases.released would probably help.
my $filt = auth->pref('filter_release') && eval { filter_parse r => auth->pref('filter_release') };
+ $filt = { $filt ? %$filt : (), date_before => undef, date_after => undef, released => $released?1:0 };
+
+ # XXX This query is kinda slow, an index on releases.released would probably help.
my $lst = tuwf->dbAlli('
SELECT id, title, original, released
FROM releases r
WHERE NOT hidden AND released', $released ? '<=' : '>', \strftime('%Y%m%d', gmtime), '
- AND ', filter_release_query($filt||{}), '
+ AND ', filter_release_query($filt), '
ORDER BY released', $released ? 'DESC' : '', ', id LIMIT 10'
);
enrich_flatten plat => id => id => 'SELECT id, platform FROM releases_platforms WHERE id IN', $lst;
enrich_flatten lang => id => id => 'SELECT id, lang FROM releases_lang WHERE id IN', $lst;
h1_ sub {
- a_ href => '/r?fil=released-0;o=a;s=released', 'Upcoming Releases' if !$released;
- a_ href => '/r?fil=released-1;o=d;s=released', 'Just Released' if $released;
+ a_ href => '/r?fil='.VNDB::Func::fil_serialize($filt).';o=a;s=released', 'Upcoming Releases' if !$released;
+ a_ href => '/r?fil='.VNDB::Func::fil_serialize($filt).';o=d;s=released', 'Just Released' if $released;
};
ul_ sub {
li_ sub {