Modifying asDictionary for exporting as static web report.
This commit is contained in:
parent
3ad7148e62
commit
c713ad9d28
@ -1,8 +1,9 @@
|
|||||||
accessing
|
accessing
|
||||||
asDictionary
|
asDictionary
|
||||||
|
|
||||||
| tweets |
|
| tweets tweetsHistogramData |
|
||||||
tweets := self messages.
|
tweets := self messages.
|
||||||
|
tweetsHistogramData := self tweetsByWeeksTimeSpan.
|
||||||
^ { 'profile-card-avatar' -> self profileImageFile fullName.
|
^ { 'profile-card-avatar' -> self profileImageFile fullName.
|
||||||
'profile-card-avatar-url' -> self profileImageUrl.
|
'profile-card-avatar-url' -> self profileImageUrl.
|
||||||
'profile-card-fullname' -> self name .
|
'profile-card-fullname' -> self name .
|
||||||
@ -10,5 +11,7 @@ asDictionary
|
|||||||
'profile-bio' -> self profileBio.
|
'profile-bio' -> self profileBio.
|
||||||
'messages-size' -> tweets size.
|
'messages-size' -> tweets size.
|
||||||
'messages-newest' -> tweets newest created asDate greaseString.
|
'messages-newest' -> tweets newest created asDate greaseString.
|
||||||
'messages-oldest' -> tweets oldest created asDate greaseString
|
'messages-oldest' -> tweets oldest created asDate greaseString.
|
||||||
|
'tweets-histogram-labels' -> tweetsHistogramData third.
|
||||||
|
'tweets-histogram-quantity' -> tweetsHistogramData second.
|
||||||
} asDictionary
|
} asDictionary
|
@ -0,0 +1,24 @@
|
|||||||
|
accessing
|
||||||
|
tweetsByWeeksTimeSpan
|
||||||
|
|
||||||
|
| weeks floor divisions tweetsByTimeSpan xAxis labels |
|
||||||
|
weeks := ((self newestTweet created - self oldestTweet created) days / 7).
|
||||||
|
floor := weeks floor.
|
||||||
|
(weeks - floor) > 0.4
|
||||||
|
ifTrue: [ divisions := floor ]
|
||||||
|
ifFalse: [ divisions := floor + 1 ].
|
||||||
|
tweetsByTimeSpan := self collectMessages: [ self tweets] byTimeSpanSplits: divisions.
|
||||||
|
xAxis := OrderedCollection new.
|
||||||
|
(tweetsByTimeSpan values collect: [ :collection | collection size ]) do: [ :number |
|
||||||
|
xAxis add: ($' asString), (number asString), ($' asString)
|
||||||
|
].
|
||||||
|
labels := OrderedCollection new.
|
||||||
|
tweetsByTimeSpan keys do: [ :string |
|
||||||
|
labels add: ($' asString), string, ($' asString)
|
||||||
|
].
|
||||||
|
^ {
|
||||||
|
tweetsByTimeSpan.
|
||||||
|
('[', (',' join: xAxis), ']').
|
||||||
|
('[', (',' join: labels), ']').
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user