Improved 'is new' postgres function to deal with skipped batch IDs.

This commit is contained in:
ThePendulum 2020-06-30 02:08:48 +02:00
parent ff384fb734
commit 3fba2d8a77
2 changed files with 2 additions and 6 deletions

View File

@ -248,7 +248,7 @@ export default {
}
.date {
&.upcoming:before {
&.new:before {
content: '';
background: var(--primary);
width: .5rem;
@ -258,10 +258,6 @@ export default {
bottom: 0;
left: -.5rem;
}
&.new {
font-weight: bold;
}
}
.site {

View File

@ -803,7 +803,7 @@ exports.up = knex => Promise.resolve()
$$ LANGUAGE SQL STABLE;
CREATE FUNCTION releases_is_new(release releases) RETURNS boolean AS $$
SELECT NOT EXISTS(SELECT true FROM batches WHERE batches.id = release.created_batch_id + 1 LIMIT 1);
SELECT EXISTS(SELECT true WHERE (SELECT id FROM batches ORDER BY created_at DESC LIMIT 1) = release.created_batch_id);
$$ LANGUAGE sql STABLE;
CREATE VIEW movie_actors AS