Creating tweets collection split by weeks.

This commit is contained in:
ruidajo 2022-06-20 20:27:47 -05:00
parent c91c793683
commit 2cec4816a3
6 changed files with 37 additions and 0 deletions

View File

@ -0,0 +1,11 @@
accessing
splitByWeeks
| response spans |
response := OrderedDictionary new.
self timeSpansByWeeks doWithIndex: [ :span :i |
response
at: span asDatesString
put: (self select: [ :message | span includes: (message created asDateAndTime)])
].
^ response

View File

@ -0,0 +1,5 @@
accessing
timeSpansByWeeks
^ (Timespan starting: self oldest created ending: self newest created)
weeks asOrderedCollection

View File

@ -0,0 +1,5 @@
*Socialmetrica
asDates
^ {self start.
(self start + self duration) - 1 milliSecond}

View File

@ -0,0 +1,9 @@
*Socialmetrica
asDatesString
| dates firstDate |
dates := self asDatesStrings.
firstDate := dates first splitOn: ' '.
firstDate removeLast.
firstDate:= '' join: firstDate.
^ firstDate, '→', (dates second copyWithoutAll: ' ')

View File

@ -0,0 +1,4 @@
*Socialmetrica
asDatesStrings
^ self asDates collect: [ :date | date asDate asString ]

View File

@ -0,0 +1,3 @@
{
"name" : "Week"
}