From cd759aa6f755aca9582ce70254e64fbd71fd0425 Mon Sep 17 00:00:00 2001 From: Manuel Hude Date: Tue, 4 May 2021 20:38:40 +0200 Subject: [PATCH] fixed bug double tweets on FE --- backend/app_be/views/twitter_api.py | 4 ++-- frontend/src/app/component/tweets/tweets.component.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/app_be/views/twitter_api.py b/backend/app_be/views/twitter_api.py index a32cdee..f669319 100644 --- a/backend/app_be/views/twitter_api.py +++ b/backend/app_be/views/twitter_api.py @@ -58,12 +58,12 @@ class twitter_api: @staticmethod def get_more_tweets(twitter_id): - last_six = api.GetUserTimeline(screen_name='waecmg4', count=6, exclude_replies=True, include_rts=False, + last_six = api.GetUserTimeline(screen_name='waecmg4', count=7, exclude_replies=True, include_rts=False, max_id=twitter_id) response = [] - for tweet in last_six: + for tweet in last_six[1:]: print(tweet) parsed_date = datetime.strptime(tweet.created_at, "%a %b %d %H:%M:%S +0000 %Y") diff --git a/frontend/src/app/component/tweets/tweets.component.ts b/frontend/src/app/component/tweets/tweets.component.ts index c661000..0bf4693 100644 --- a/frontend/src/app/component/tweets/tweets.component.ts +++ b/frontend/src/app/component/tweets/tweets.component.ts @@ -61,10 +61,10 @@ export class TweetsComponent implements OnInit { this._snackbarService.show('Keine weiteren Tweets vorhanden', 'Schließen'); } - for (const tweet of data) { const position = tweet.text.search(': http'); tweet.text = tweet.text.substring(0, position); + this.tweets.push(tweet); } }, err => {