From 91744733bdeacd045d41c60df724a12431de3385 Mon Sep 17 00:00:00 2001 From: ruidajo Date: Fri, 3 Jun 2022 19:43:01 -0500 Subject: [PATCH] Creating replies and quotes static web report histogram. --- .../NitterUser.class/instance/asDictionary.st | 8 +++++++- .../instance/installTemplate.st | 3 ++- .../instance/quotesReportData.st | 14 ++++++++++++++ .../instance/repliesByWeeksTimeSpan.st | 19 +++++++++++++++++++ .../instance/tweetsByWeeksTimeSpan.st | 11 +++-------- .../instance/tweetsDivisionsByWeeks.st | 10 ++++++++++ 6 files changed, 55 insertions(+), 10 deletions(-) create mode 100644 Socialmetrica.package/NitterUser.class/instance/quotesReportData.st create mode 100644 Socialmetrica.package/NitterUser.class/instance/repliesByWeeksTimeSpan.st create mode 100644 Socialmetrica.package/NitterUser.class/instance/tweetsDivisionsByWeeks.st diff --git a/Socialmetrica.package/NitterUser.class/instance/asDictionary.st b/Socialmetrica.package/NitterUser.class/instance/asDictionary.st index f92d2c3..2876ed5 100644 --- a/Socialmetrica.package/NitterUser.class/instance/asDictionary.st +++ b/Socialmetrica.package/NitterUser.class/instance/asDictionary.st @@ -1,9 +1,11 @@ accessing asDictionary - | tweets tweetsHistogramData | + | tweets tweetsHistogramData repliesHistogramData quotesHistogramData | tweets := self messages. tweetsHistogramData := self tweetsByWeeksTimeSpan. + repliesHistogramData := self repliesByWeeksTimeSpan. + quotesHistogramData := self quotesReportData. ^ { 'profile-card-avatar' -> self profileImageFile fullName. 'profile-card-avatar-url' -> self profileImageUrl. 'profile-card-fullname' -> self name . @@ -14,4 +16,8 @@ asDictionary 'messages-oldest' -> tweets oldest created asDate greaseString. 'tweets-histogram-labels' -> tweetsHistogramData third. 'tweets-histogram-quantity' -> tweetsHistogramData second. + 'replies-histogram-labels' -> repliesHistogramData third. + 'replies-histogram-quantity' -> repliesHistogramData second. + 'quotes-histogram-labels' -> quotesHistogramData third. + 'quotes-histogram-quantity' -> quotesHistogramData second. } asDictionary \ No newline at end of file diff --git a/Socialmetrica.package/NitterUser.class/instance/installTemplate.st b/Socialmetrica.package/NitterUser.class/instance/installTemplate.st index 87deded..ba8310d 100644 --- a/Socialmetrica.package/NitterUser.class/instance/installTemplate.st +++ b/Socialmetrica.package/NitterUser.class/instance/installTemplate.st @@ -5,7 +5,8 @@ installTemplate templateFiles := #( 'https://mutabit.com/repos.fossil/mutabit/raw?name=plantillas/TwentySecondsCV/twentysecondcvMod.cls&ci=tip' 'https://mutabit.com/repos.fossil/mutabit/raw?name=plantillas/TwentySecondsCV/template.mus.tex&ci=tip' -'https://mutabit.com/repos.fossil/mutabit/raw?name=plantillas/SarissaPersonalBlog/index.mus.html&ci=tip'). +'https://mutabit.com/repos.fossil/mutabit/raw?name=plantillas/SarissaPersonalBlog/index.mus.html&ci=tip' +'https://mutabit.com/repos.fossil/mutabit/raw?name=plantillas/SarissaPersonalBlog/output.css&ci=tip'). folder := TweetsCollection dataStore / 'templates'. folder exists ifTrue: [ folder ensureDeleteAllChildren ] diff --git a/Socialmetrica.package/NitterUser.class/instance/quotesReportData.st b/Socialmetrica.package/NitterUser.class/instance/quotesReportData.st new file mode 100644 index 0000000..e5b7b78 --- /dev/null +++ b/Socialmetrica.package/NitterUser.class/instance/quotesReportData.st @@ -0,0 +1,14 @@ +accessing +quotesReportData + + | tempDict labels xAxis | + tempDict := self quotesSortedByOccurrences. + labels := tempDict keys. + labels := labels collect: [ :profile | ($' asString), '@', profile, ($' asString) ]. + xAxis := tempDict values. + xAxis := xAxis collect: [ :value | ($' asString), (value asString), ($' asString) ]. + ^ { + tempDict. + ('[', (',' join: xAxis), ']'). + ('[', (',' join: labels), ']'). + } \ No newline at end of file diff --git a/Socialmetrica.package/NitterUser.class/instance/repliesByWeeksTimeSpan.st b/Socialmetrica.package/NitterUser.class/instance/repliesByWeeksTimeSpan.st new file mode 100644 index 0000000..3c94c0a --- /dev/null +++ b/Socialmetrica.package/NitterUser.class/instance/repliesByWeeksTimeSpan.st @@ -0,0 +1,19 @@ +accessing +repliesByWeeksTimeSpan + + | tweetsByTimeSpan xAxis labels | + tweetsByTimeSpan := self collectMessages: [ self replies ] byTimeSpanSplits: self tweetsDivisionsByWeeks. + 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), ']'). + } + \ No newline at end of file diff --git a/Socialmetrica.package/NitterUser.class/instance/tweetsByWeeksTimeSpan.st b/Socialmetrica.package/NitterUser.class/instance/tweetsByWeeksTimeSpan.st index 9a84e68..06e22fa 100644 --- a/Socialmetrica.package/NitterUser.class/instance/tweetsByWeeksTimeSpan.st +++ b/Socialmetrica.package/NitterUser.class/instance/tweetsByWeeksTimeSpan.st @@ -1,20 +1,15 @@ 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. + | tweetsByTimeSpan xAxis labels | + tweetsByTimeSpan := self collectMessages: [ self tweets] byTimeSpanSplits: self tweetsDivisionsByWeeks. 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) + labels add: ($' asString), string, ($' asString) ]. ^ { tweetsByTimeSpan. diff --git a/Socialmetrica.package/NitterUser.class/instance/tweetsDivisionsByWeeks.st b/Socialmetrica.package/NitterUser.class/instance/tweetsDivisionsByWeeks.st new file mode 100644 index 0000000..2873e3f --- /dev/null +++ b/Socialmetrica.package/NitterUser.class/instance/tweetsDivisionsByWeeks.st @@ -0,0 +1,10 @@ +accessing +tweetsDivisionsByWeeks + + | weeks floor divisions | + weeks := ((self newestTweet created - self oldestTweet created) days / 7). + floor := weeks floor. + (weeks - floor) > 0.4 + ifTrue: [ divisions := floor ] + ifFalse: [ divisions := floor + 1 ]. + ^ divisions \ No newline at end of file