Fixing connection to ReStore DB in tweets collection.

This commit is contained in:
ruidajo 2022-04-14 16:43:31 -05:00
parent 02ab2bd74a
commit b9eedc6ec3
3 changed files with 12 additions and 7 deletions

View File

@ -3,7 +3,7 @@ externalWordCloud
| text outputFile | | text outputFile |
outputFile := (self folder / 'nube.png') fullName. outputFile := (self folder / 'nube.png') fullName.
text := (self folder / self userName, 'words', 'txt')fullName. text := (self folder / 'words', 'txt') fullName.
OSSUnixSubprocess new OSSUnixSubprocess new
command: 'wordcloud_cli'; command: 'wordcloud_cli';
arguments: { '--text' . text . arguments: { '--text' . text .

View File

@ -1,12 +1,15 @@
accessing accessing
getLocalMessages getLocalMessages
"TO DO! This method should return messages from the local database" "TO DO! This method should return messages from the local database"
| allTweets myTweets | | allTweets myTweets tempTweets tempUsername |
tempUsername := self userName.
TweetsCollection storeDB.
allTweets := Tweet storedInstances asOrderedCollection. allTweets := Tweet storedInstances asOrderedCollection.
allTweets ifNil: [ ^ nil ]. allTweets ifNil: [ ^ nil ].
myTweets := TweetsCollection new. myTweets := TweetsCollection new.
myTweets tweets: (allTweets select: [ :each | each timelines isNotEmpty and: [each timelines keys first = self userName] ] ). tempTweets := allTweets select: [ :each | each timelines isNotEmpty and: [each timelines keys first = tempUsername] ].
myTweets tweets: tempTweets.
self tweets: myTweets. self tweets: myTweets.
^ self tweets ^ {self tweets. self userName. tempTweets}

View File

@ -1,5 +1,7 @@
accessing accessing
storeDB storeDB
| localDBFile | | localDBFile localDBConnection |
localDBFile := FileLocator userData / 'Socialmetrica' / 'socialmetrica.sqlite'. localDBFile := FileLocator userData / 'Socialmetrica' / 'socialmetrica.sqlite'.
^ ReStore connection: (SSWSQLite3Connection on: localDBFile fullName). localDBConnection := ReStore connection: (SSWSQLite3Connection on: localDBFile fullName).
localDBConnection isConnected ifFalse: [ ^ localDBConnection connect ].
^ localDBConnection