This commit is contained in:
Offray Vladimir Luna Cárdenas 2022-05-15 16:32:33 -05:00
commit 75290c2538
5 changed files with 13 additions and 10 deletions

View File

@ -1,4 +1,4 @@
accessing
newestTweet
^ self messages newestOf: self id
^ self messages newestOf: self userName

View File

@ -1,4 +1,4 @@
accessing
oldestTweet
^ self messages oldestOf: self id
^ self messages oldestOf: self userName

View File

@ -3,6 +3,5 @@ replies
self messages ifEmpty: [ self getMessages ].
^ TweetsCollection new
messages: (self messages select: [ :each | (each metadata at: 'replie to') isNotEmpty
and: [ each authorId = self id ]]);
messages: (self tweets select: [ :each | (each metadata at: 'replie to') isNotEmpty]);
yourself

View File

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

View File

@ -1,7 +1,9 @@
accessing
oldestOf: userId
oldestOf: userName
| user |
user := (TwitterUser storedInstances select: [ :each | each userName = userName ]) first.
self messages ifNil: [ ^ nil ].
self messages ifEmpty: [ ^ nil ].
^ ((self select: [ :tweet | tweet authorId = userId ])
select: [ :tweet | tweet created = (((self select: [ :each | each authorId = userId ]) collect: [ :each | each created ]) asSortedCollection first)]) first
^ ((user messages: self; yourself; tweets)
select: [ :tweet | tweet created = ((self collect: [ :each | each created ]) asSortedCollection first)]) first.