Modifying newest and oldest tweet selection.

This commit is contained in:
ruidajo 2022-05-15 17:15:12 -05:00
parent 75290c2538
commit f9b7fdf6bb
4 changed files with 13 additions and 5 deletions

View File

@ -1,4 +1,4 @@
accessing
newestTweet
^ self messages newestOf: self userName
^ (self tweets select: [ :tweet | tweet created = ((self tweets collect: [ :each | each created ]) asSortedCollection last)]) first.

View File

@ -1,4 +1,4 @@
accessing
oldestTweet
^ self messages oldestOf: self userName
^ (self tweets select: [ :tweet | tweet created = ((self tweets collect: [ :each | each created ]) asSortedCollection first)]) first.

View File

@ -13,8 +13,15 @@ tweets
subcollection := self messages
select: [ :each | (each authorId = '1502504562984374276') or: [ each authorId = self id ] ]
].
(self userName ~= 'FranciaMarquezM' and: [ self userName ~= 'sandralajas' ])
ifTrue: [ subcollection := self messages select: [ :each | each authorId = self id ] ].
self userName = 'IBetancourtCol'
ifTrue: [
subcollection := self messages
select: [ :each | (each authorId = '1517487571135344643') or: [ each authorId = self id ] ]
].
(self userName ~= 'FranciaMarquezM' and: [ self userName ~= 'sandralajas' ])
ifTrue: [ self userName ~= 'IBetancourtCol' ifTrue:
[ subcollection := self messages select: [ :each | each authorId = self id ]]
].
^ TweetsCollection new
messages: subcollection;
yourself

View File

@ -5,5 +5,6 @@ newestOf: userName
user := (TwitterUser storedInstances select: [ :each | each userName = userName ]) first.
self messages ifNil: [ ^ nil ].
self messages ifEmpty: [ ^ nil ].
^ ((user messages: self; yourself; tweets)
user messages: self.
^ ((user tweets)
select: [ :tweet | tweet created = ((self collect: [ :each | each created ]) asSortedCollection last)]) first.