Creating tweets collection split by weeks.
This commit is contained in:
parent
c91c793683
commit
2cec4816a3
@ -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
|
@ -0,0 +1,5 @@
|
||||
accessing
|
||||
timeSpansByWeeks
|
||||
|
||||
^ (Timespan starting: self oldest created ending: self newest created)
|
||||
weeks asOrderedCollection
|
5
Socialmetrica.package/Week.extension/instance/asDates.st
Normal file
5
Socialmetrica.package/Week.extension/instance/asDates.st
Normal file
@ -0,0 +1,5 @@
|
||||
*Socialmetrica
|
||||
asDates
|
||||
|
||||
^ {self start.
|
||||
(self start + self duration) - 1 milliSecond}
|
@ -0,0 +1,9 @@
|
||||
*Socialmetrica
|
||||
asDatesString
|
||||
|
||||
| dates firstDate |
|
||||
dates := self asDatesStrings.
|
||||
firstDate := dates first splitOn: ' '.
|
||||
firstDate removeLast.
|
||||
firstDate:= '' join: firstDate.
|
||||
^ firstDate, '→', (dates second copyWithoutAll: ' ')
|
@ -0,0 +1,4 @@
|
||||
*Socialmetrica
|
||||
asDatesStrings
|
||||
|
||||
^ self asDates collect: [ :date | date asDate asString ]
|
3
Socialmetrica.package/Week.extension/properties.json
Normal file
3
Socialmetrica.package/Week.extension/properties.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"name" : "Week"
|
||||
}
|
Loading…
Reference in New Issue
Block a user