From 99a03c0ad180ec840120e9ac3acfc90745af9e69 Mon Sep 17 00:00:00 2001 From: Offray Luna Date: Tue, 19 Apr 2022 00:19:23 -0500 Subject: [PATCH] Tweets collection now inherits from OrderedCollection to improve reusability. --- Socialmetrica.package/NitterUser.class/instance/quotes.st | 4 +++- .../TweetsCollection.class/instance/messages..st | 4 +++- .../TweetsCollection.class/instance/messages.st | 2 +- .../TweetsCollection.class/instance/store.st | 4 ++-- Socialmetrica.package/TweetsCollection.class/properties.json | 5 ++--- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/Socialmetrica.package/NitterUser.class/instance/quotes.st b/Socialmetrica.package/NitterUser.class/instance/quotes.st index c41c3a8..3895f62 100644 --- a/Socialmetrica.package/NitterUser.class/instance/quotes.st +++ b/Socialmetrica.package/NitterUser.class/instance/quotes.st @@ -3,5 +3,7 @@ quotes self messages ifEmpty: [ self getMessages ]. ^ TweetsCollection new - messages: (self messages messages select: [ :each | (each metadata at: 'quote') isNotEmpty ]); + messages: (self messages messages + select: [ :each | + (each metadata at: 'quote') isNotEmpty and: [ each user userName = self userName] ]); yourself \ No newline at end of file diff --git a/Socialmetrica.package/TweetsCollection.class/instance/messages..st b/Socialmetrica.package/TweetsCollection.class/instance/messages..st index aa324df..1d85262 100644 --- a/Socialmetrica.package/TweetsCollection.class/instance/messages..st +++ b/Socialmetrica.package/TweetsCollection.class/instance/messages..st @@ -1,3 +1,5 @@ accessing messages: aTweetsCollection - ^ messages := aTweetsCollection \ No newline at end of file + firstIndex := 1. + lastIndex := aTweetsCollection size. + ^ array := aTweetsCollection \ No newline at end of file diff --git a/Socialmetrica.package/TweetsCollection.class/instance/messages.st b/Socialmetrica.package/TweetsCollection.class/instance/messages.st index 0943f57..b3a1cb3 100644 --- a/Socialmetrica.package/TweetsCollection.class/instance/messages.st +++ b/Socialmetrica.package/TweetsCollection.class/instance/messages.st @@ -1,3 +1,3 @@ accessing messages - ^ messages ifNil: [ messages := OrderedCollection new ] \ No newline at end of file + ^ array ifNil: [ array := OrderedCollection new ] \ No newline at end of file diff --git a/Socialmetrica.package/TweetsCollection.class/instance/store.st b/Socialmetrica.package/TweetsCollection.class/instance/store.st index 34ec044..f9922a4 100644 --- a/Socialmetrica.package/TweetsCollection.class/instance/store.st +++ b/Socialmetrica.package/TweetsCollection.class/instance/store.st @@ -1,7 +1,7 @@ accessing store - ReStore isConnected ifFalse: [ self class storeDB]. "Starting the ReStore singleton." - self messages do: [:each | ReStore evaluateAsTransaction: [ + ReStore isConnected ifFalse: [ self class storeDB ]. "Starting the ReStore singleton." + self messages do: [ :each | ReStore evaluateAsTransaction: [ each store. each user isInDB ifFalse: [ each user store ] ] diff --git a/Socialmetrica.package/TweetsCollection.class/properties.json b/Socialmetrica.package/TweetsCollection.class/properties.json index 9a11b85..7a64ffc 100644 --- a/Socialmetrica.package/TweetsCollection.class/properties.json +++ b/Socialmetrica.package/TweetsCollection.class/properties.json @@ -1,13 +1,12 @@ { "commentStamp" : "", - "super" : "Object", + "super" : "OrderedCollection", "category" : "Socialmetrica", "classinstvars" : [ ], "pools" : [ ], "classvars" : [ ], "instvars" : [ - "query", - "messages" + "query" ], "name" : "TweetsCollection", "type" : "normal"