Skip to content

Commit

Permalink
Add tweetId to getMostTweets (#4492)
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanIvanoff authored Dec 4, 2024
1 parent 289cbf7 commit 438f06e
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 14 deletions.
1 change: 1 addition & 0 deletions lib/sanbase/social_data/tweet.ex
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ defmodule Sanbase.SocialData.Tweet do
tweets =
Enum.map(list, fn map ->
%{
tweet_id: Map.fetch!(map, "tweet_id") |> to_string(),
text: Map.fetch!(map, "text"),
screen_name: Map.fetch!(map, "screen_name"),
datetime:
Expand Down
1 change: 1 addition & 0 deletions lib/sanbase_web/graphql/schema/types/social_data_types.ex
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ defmodule SanbaseWeb.Graphql.SocialDataTypes do
end

object :tweet do
field(:tweet_id, non_null(:string))
field(:datetime, non_null(:datetime))
field(:text, non_null(:string))
field(:screen_name, non_null(:string))
Expand Down
33 changes: 19 additions & 14 deletions test/sanbase_web/graphql/social_data/most_tweets_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ defmodule SanbaseWeb.Graphql.MostTweetsSocialDataTest do
size: 2){
slug
tweets{
tweetId
datetime
text
screenName
Expand All @@ -50,24 +51,26 @@ defmodule SanbaseWeb.Graphql.MostTweetsSocialDataTest do
"slug" => "bitcoin",
"tweets" => [
%{
"datetime" => "2024-11-26T18:21:30Z",
"datetime" => "2024-11-27T21:19:50Z",
"repliesCount" => 0,
"retweetsCount" => 0,
"screenName" => "take_gains",
"sentimentNegative" => 0.0171372827,
"sentimentPositive" => 0.9828627173,
"screenName" => "CryptoLifer33",
"sentimentNegative" => 0.0044069796,
"sentimentPositive" => 0.9955930204,
"text" =>
"Whipsaw wick completed, lets continue. \n\n$BTC https://t.co/e8mH8RUKjO"
"Life is good. I made thousands trading today and life is good. Thank God, thanks to Bitcoin, my family and #Florida What do you do to celebrate your wins? https://t.co/gY5c5Eb8Dh",
"tweetId" => "1861882647930085536"
},
%{
"datetime" => "2024-11-26T19:07:51Z",
"datetime" => "2024-11-26T18:21:30Z",
"repliesCount" => 0,
"retweetsCount" => 0,
"screenName" => "IIICapital",
"sentimentNegative" => 0.0222001588,
"sentimentPositive" => 0.9777998412,
"screenName" => "take_gains",
"sentimentNegative" => 0.0171372827,
"sentimentPositive" => 0.9828627173,
"text" =>
"Incredible podcast with two of the sharpest minds in bitcoin.\n\nThank you both for the time @Excellion and @dhruvbansal.\n\nTune in and comment whether you think bitcoin was an invention or discovery!"
"Whipsaw wick completed, lets continue. \n\n$BTC https://t.co/e8mH8RUKjO",
"tweetId" => "1861475381548851381"
}
]
} in result
Expand All @@ -83,7 +86,8 @@ defmodule SanbaseWeb.Graphql.MostTweetsSocialDataTest do
"sentimentNegative" => 0.0269591219,
"sentimentPositive" => 0.9730408781,
"text" =>
"Thanks for hosting this debate @laurashin! While I think Justin and I share a similar vision of what Ethereum should ideally become in a couple of years, he thinks we are on track for it - I believe decisive action is needed now to achieve that vision."
"Thanks for hosting this debate @laurashin! While I think Justin and I share a similar vision of what Ethereum should ideally become in a couple of years, he thinks we are on track for it - I believe decisive action is needed now to achieve that vision.",
"tweetId" => "1861456784457654773"
},
%{
"datetime" => "2024-11-27T14:00:12Z",
Expand All @@ -93,7 +97,8 @@ defmodule SanbaseWeb.Graphql.MostTweetsSocialDataTest do
"sentimentNegative" => 0.0277438289,
"sentimentPositive" => 0.9722561711,
"text" =>
"New Launch Alert ✈️\n\nA big welcome to @doge_eth_gov who have launched an $DOGE - $WETH pool on Aerodrome.\n\nBridge $DOGE from Ethereum mainnet to @base, powered by @axelar: https://t.co/wejMHuq62H\n\nLiquidity has been added and LP rewards incoming. https://t.co/A5lpoDZakD"
"New Launch Alert ✈️\n\nA big welcome to @doge_eth_gov who have launched an $DOGE - $WETH pool on Aerodrome.\n\nBridge $DOGE from Ethereum mainnet to @base, powered by @axelar: https://t.co/wejMHuq62H\n\nLiquidity has been added and LP rewards incoming. https://t.co/A5lpoDZakD",
"tweetId" => "1861772012814991729"
}
]
} in result
Expand All @@ -104,9 +109,9 @@ defmodule SanbaseWeb.Graphql.MostTweetsSocialDataTest do
%{
"data" => %{
"bitcoin" =>
"[{\"screen_name\":\"take_gains\",\"text\":\"Whipsaw wick completed, lets continue. \\n\\n$BTC https:\\/\\/t.co\\/e8mH8RUKjO\",\"reply\":0,\"retweet\":0,\"timestamp\":\"2024-11-26T18:21:30\",\"sentiment_neg\":0.0171372827,\"sentiment_pos\":0.9828627173},{\"screen_name\":\"IIICapital\",\"text\":\"Incredible podcast with two of the sharpest minds in bitcoin.\\n\\nThank you both for the time @Excellion and @dhruvbansal.\\n\\nTune in and comment whether you think bitcoin was an invention or discovery!\",\"reply\":0,\"retweet\":0,\"timestamp\":\"2024-11-26T19:07:51\",\"sentiment_neg\":0.0222001588,\"sentiment_pos\":0.9777998412}]",
"[{\"tweet_id\":1861882647930085536,\"screen_name\":\"CryptoLifer33\",\"text\":\"Life is good. I made thousands trading today and life is good. Thank God, thanks to Bitcoin, my family and #Florida What do you do to celebrate your wins? https:\\/\\/t.co\\/gY5c5Eb8Dh\",\"reply\":0,\"retweet\":0,\"timestamp\":\"2024-11-27T21:19:50\",\"sentiment_neg\":0.0044069796,\"sentiment_pos\":0.9955930204},{\"tweet_id\":1861475381548851381,\"screen_name\":\"take_gains\",\"text\":\"Whipsaw wick completed, lets continue. \\n\\n$BTC https:\\/\\/t.co\\/e8mH8RUKjO\",\"reply\":0,\"retweet\":0,\"timestamp\":\"2024-11-26T18:21:30\",\"sentiment_neg\":0.0171372827,\"sentiment_pos\":0.9828627173}]",
"ethereum" =>
"[{\"screen_name\":\"koeppelmann\",\"text\":\"Thanks for hosting this debate @laurashin! While I think Justin and I share a similar vision of what Ethereum should ideally become in a couple of years, he thinks we are on track for it - I believe decisive action is needed now to achieve that vision.\",\"reply\":0,\"retweet\":0,\"timestamp\":\"2024-11-26T17:07:36\",\"sentiment_neg\":0.0269591219,\"sentiment_pos\":0.9730408781},{\"screen_name\":\"AerodromeFi\",\"text\":\"New Launch Alert \\u2708\\ufe0f\\n\\nA big welcome to @doge_eth_gov who have launched an $DOGE - $WETH pool on Aerodrome.\\n\\nBridge $DOGE from Ethereum mainnet to @base, powered by @axelar: https:\\/\\/t.co\\/wejMHuq62H\\n\\nLiquidity has been added and LP rewards incoming. https:\\/\\/t.co\\/A5lpoDZakD\",\"reply\":0,\"retweet\":1,\"timestamp\":\"2024-11-27T14:00:12\",\"sentiment_neg\":0.0277438289,\"sentiment_pos\":0.9722561711}]"
"[{\"tweet_id\":1861456784457654773,\"screen_name\":\"koeppelmann\",\"text\":\"Thanks for hosting this debate @laurashin! While I think Justin and I share a similar vision of what Ethereum should ideally become in a couple of years, he thinks we are on track for it - I believe decisive action is needed now to achieve that vision.\",\"reply\":0,\"retweet\":0,\"timestamp\":\"2024-11-26T17:07:36\",\"sentiment_neg\":0.0269591219,\"sentiment_pos\":0.9730408781},{\"tweet_id\":1861772012814991729,\"screen_name\":\"AerodromeFi\",\"text\":\"New Launch Alert \\u2708\\ufe0f\\n\\nA big welcome to @doge_eth_gov who have launched an $DOGE - $WETH pool on Aerodrome.\\n\\nBridge $DOGE from Ethereum mainnet to @base, powered by @axelar: https:\\/\\/t.co\\/wejMHuq62H\\n\\nLiquidity has been added and LP rewards incoming. https:\\/\\/t.co\\/A5lpoDZakD\",\"reply\":0,\"retweet\":1,\"timestamp\":\"2024-11-27T14:00:12\",\"sentiment_neg\":0.0277438289,\"sentiment_pos\":0.9722561711}]"
}
}
end
Expand Down

0 comments on commit 438f06e

Please sign in to comment.