From 61eb15f8e399b474a7c75dd42510e4d68a42ec26 Mon Sep 17 00:00:00 2001 From: ruidajo Date: Wed, 15 Jun 2022 18:43:59 -0500 Subject: [PATCH] Creating author ids to get all the ids from database and refactoring tweets filtering. --- .../NitterUser.class/instance/authorIds.st | 4 ++ .../NitterUser.class/instance/tweets.st | 38 +++---------------- 2 files changed, 10 insertions(+), 32 deletions(-) create mode 100644 Socialmetrica.package/NitterUser.class/instance/authorIds.st diff --git a/Socialmetrica.package/NitterUser.class/instance/authorIds.st b/Socialmetrica.package/NitterUser.class/instance/authorIds.st new file mode 100644 index 0000000..8545f6c --- /dev/null +++ b/Socialmetrica.package/NitterUser.class/instance/authorIds.st @@ -0,0 +1,4 @@ +accessing +authorIds + + ^ TwitterUser storedInstances select: [ :each | each userName = self userName ] thenCollect: [ :each | each id ] \ No newline at end of file diff --git a/Socialmetrica.package/NitterUser.class/instance/tweets.st b/Socialmetrica.package/NitterUser.class/instance/tweets.st index ea8a4df..a5a61b5 100644 --- a/Socialmetrica.package/NitterUser.class/instance/tweets.st +++ b/Socialmetrica.package/NitterUser.class/instance/tweets.st @@ -3,38 +3,12 @@ tweets | subcollection | self messages ifEmpty: [ self getMessages ]. "TO DO: It seems that Twitter changes the user id, which we thought was unchangeable. This deals with the detected changes so far." - self userName = 'FranciaMarquezM' - ifTrue: [ - subcollection := self messages - select: [ :each | (each authorId = '1510420950801698826') or: [ each authorId = self id ] ] - ]. - self userName = 'sandralajas' - ifTrue: [ - subcollection := self messages - select: [ :each | (each authorId = '1502504562984374276') or: [ each authorId = self id ] ] - ]. - self userName = 'IBetancourtCol' - ifTrue: [ - subcollection := self messages - select: [ :each | (each authorId = '1517487571135344643') or: [ each authorId = self id ] ] - ]. - self userName = 'sergio_fajardo' - ifTrue: [ - subcollection := self messages - select: [ :each | (each authorId = '1509644668300058633') or: [ each authorId = self id ] ] - ]. - self userName = 'ingrodolfohdez' - ifTrue: [ - subcollection := self messages - select: [ :each | (each authorId = '1511813393220616192') or: [ each authorId = self id ] ] - ]. - self userName = 'CastilloMarelen' - ifTrue: [ - subcollection := self messages - select: [ :each | (each authorId = '1506282884746952707') or: [ each authorId = self id ] ] - ]. -(#('FranciaMarquezM' 'sandralajas' 'IBetancourtCol' 'sergio_fajardo' 'ingrodolfohdez' 'CastilloMarelen') includes: self userName) - ifFalse: [ subcollection := self messages select: [ :each | each authorId = self id ]]. + + subcollection := self messages + select: [ :each | self authorIds includes: each authorId ]. + + (#('FranciaMarquezM' 'sandralajas' 'IBetancourtCol' 'sergio_fajardo' 'ingrodolfohdez' 'CastilloMarelen') includes: self userName) + ifFalse: [ subcollection := self messages select: [ :each | each authorId = self id ]]. ^ TweetsCollection new messages: subcollection; yourself \ No newline at end of file