✨ pick-show: Skip completed shows
This commit is contained in:
parent
6de306fd36
commit
6c64213999
1 changed files with 11 additions and 5 deletions
|
|
@ -78,20 +78,26 @@
|
||||||
function filterShows($shows) {
|
function filterShows($shows) {
|
||||||
|
|
||||||
// Milliseconds in two days
|
// Milliseconds in two days
|
||||||
let twoDays = 2 * 24 * 60 * 60 * 1000;
|
const twoDays = 2 * 24 * 60 * 60 * 1000;
|
||||||
let twoDaysAgo = (new Date()) - twoDays;
|
const twoDaysAgo = (new Date()) - twoDays;
|
||||||
|
|
||||||
$shows.each(function (i, show) {
|
$shows.each(function (i, show) {
|
||||||
|
|
||||||
let showId = Number.parseInt(show.dataset.showId);
|
const showId = Number.parseInt(show.dataset.showId);
|
||||||
let showInfo = watched_shows[showId];
|
const showInfo = watched_shows[showId];
|
||||||
if (!showInfo) return;
|
if (!showInfo) return;
|
||||||
|
|
||||||
let lastWatch = showInfo.ts*1000;
|
const lastWatch = showInfo.ts*1000;
|
||||||
// Skip ones we've watched in the last two days
|
// Skip ones we've watched in the last two days
|
||||||
if (lastWatch > twoDaysAgo) {
|
if (lastWatch > twoDaysAgo) {
|
||||||
show.classList.add('sortable-ghost');
|
show.classList.add('sortable-ghost');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const percentage = show.dataset.percentage;
|
||||||
|
|
||||||
|
if (percentage == 100) {
|
||||||
|
show.classList.add('sortable-ghost');
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return $shows.filter(':not(.sortable-ghost)');
|
return $shows.filter(':not(.sortable-ghost)');
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue