From 6bcdaf7d8c876810ad92e59d102ef4592ca3071f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20Hn=C3=A1t?= Date: Thu, 3 Nov 2022 15:14:03 +0100 Subject: [PATCH] Added if statement --- __pycache__/dashboard.cpython-310.pyc | Bin 1575 -> 1575 bytes dashboard_static/js/events.js | 2 +- dashboard_static/lib/tweets.js | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/__pycache__/dashboard.cpython-310.pyc b/__pycache__/dashboard.cpython-310.pyc index ab7ebca5d192afbbc21ac33e12aff0df021f0b95..986186a6cd646aeb53e2fb7475c0e923fb29ab99 100644 GIT binary patch delta 19 ZcmZ3^vz&)3pO=@50SMgBY~+$<0{|*Y1N8s^ delta 19 ZcmZ3^vz&)3pO=@50SFcy+Q=o#1^_HN1V#V= diff --git a/dashboard_static/js/events.js b/dashboard_static/js/events.js index 8a49af8..015b661 100644 --- a/dashboard_static/js/events.js +++ b/dashboard_static/js/events.js @@ -81,7 +81,7 @@ $(window).on("filter", function() { tweets = filterTweets(tweets, filters.blockedWords, filters.searchedWords.concat(filters.sports), filters.sorted, filters.order); tweets = sortTweets(tweets, [filters.sorted, filters.order]); var displayTweets = tweets.reverse().slice(0, 20).reverse(); - for (i = 0; i < 19; i++){ + for (i = 0; i < Math.min(19, displayTweets.length); i++){ tweet = displayTweets[i]; parent.prepend(tweetCell(tweet)); } diff --git a/dashboard_static/lib/tweets.js b/dashboard_static/lib/tweets.js index da10619..3addfcb 100644 --- a/dashboard_static/lib/tweets.js +++ b/dashboard_static/lib/tweets.js @@ -90,7 +90,7 @@ block.fn.tweets = function(config) { // remove tweets $list.replaceChildren(); var displayTweets = tweets.reverse().slice(0, options.memory).reverse(); - for (i = 0; i < options.memory-1; i++){ + for (i = 0; i < Math.min(options.memory-1, displayTweets.length); i++){ $list.prepend(tweetCell(displayTweets[i])); }