Refactoring messages.

This commit is contained in:
ruidajo 2023-07-27 11:20:19 -05:00
parent 43662d3fce
commit 57186f444f
2 changed files with 15 additions and 8 deletions

View File

@ -0,0 +1,8 @@
accessing
configureDefaultReportingPeriod
[ config at: 'reportingPeriod' ]
onErrorDo: [ self config
at: 'reportingPeriod'
put: (Timespan
starting: messages oldest created asDateAndTime
ending: messages newest created asDateAndTime + 1 minute) ]

View File

@ -1,13 +1,12 @@
accessing
messages
messages ifNil: [ messages := TweetsCollection new ].
messages ifEmpty: [ self getLocalMessages ].
messages ifEmpty: [ self getRemoteMessagesFromHtml ].
[ config at: 'reportingPeriod' ]
onErrorDo: [ self config
at: 'reportingPeriod'
put: (Timespan
starting: (messages oldest created asDateAndTime)
ending: (messages newest created asDateAndTime + 1 minute)) ].
^ messages select: [ :message | message created between: self reportingPeriod start and: self reportingPeriod end ]
config at: 'reportingPeriod' ifAbsent: [ ^ messages ].
"self configureDefaultReportingPeriod."
^ messages
select: [ :message |
message created
between: self reportingPeriod start
and: self reportingPeriod end ]