2022-04-16 17:08:30 +00:00
|
|
|
accessing
|
|
|
|
collectMessages: aBlock byTimeSpanSplits: anInteger
|
|
|
|
| timespans spanLabels messagesByTimespan |
|
|
|
|
timespans := aBlock value timeSpansOf: anInteger.
|
2022-05-03 03:31:41 +00:00
|
|
|
spanLabels := (timespans collect: [ :timeSpan | | start end |
|
|
|
|
start := (timeSpan start dayOfMonth) asString, ' ', ((timeSpan start monthName) asString copyFrom:1 to: 3).
|
|
|
|
end := (timeSpan end dayOfMonth) asString, ' ', ((timeSpan end monthName) asString copyFrom:1 to: 3).
|
|
|
|
start, '→ ', end
|
2022-04-16 17:08:30 +00:00
|
|
|
]) asArray.
|
|
|
|
messagesByTimespan := OrderedDictionary new.
|
|
|
|
spanLabels doWithIndex: [:label :i |
|
|
|
|
messagesByTimespan
|
|
|
|
at: label
|
|
|
|
put: (aBlock value messages select: [ :message |
|
|
|
|
(timespans at: i) includes: (message created asDateAndTime)])
|
|
|
|
].
|
|
|
|
^ messagesByTimespan
|