From 4c9701965a2d576809921b3a94b3bb08b41aafae Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sun, 29 Aug 2021 13:51:03 +0200 Subject: [PATCH] User Profile and Bot Profiles Statistics done --- Network/Queries/BotProfileStats.js | 15 ++++++++------- Network/Queries/UserProfileStats.js | 11 +++++------ Network/Query.js | 7 +++++++ Network/clientsInterface.js | 9 ++++++--- 4 files changed, 26 insertions(+), 16 deletions(-) diff --git a/Network/Queries/BotProfileStats.js b/Network/Queries/BotProfileStats.js index 137072fb9..510f1ebb3 100644 --- a/Network/Queries/BotProfileStats.js +++ b/Network/Queries/BotProfileStats.js @@ -15,13 +15,13 @@ exports.newBotProfileStats = function newBotProfileStats() { function initialize(queryReceived) { /* - Validate Bot Profile + Validate User Profile */ let userProfile - if (queryReceived.targetBotProfileId !== undefined) { + if (queryReceived.targetUserProfileId !== undefined) { userProfile = NT.memory.maps.USER_PROFILES_BY_ID.get(queryReceived.targetUserProfileId) } else { - userProfile = NT.memory.maps.USER_PROFILES_BY_HANDLE.get(queryReceived.targetUserProfileId) + userProfile = NT.memory.maps.USER_PROFILES_BY_HANDLE.get(queryReceived.targetUserProfileHandle) } if (userProfile === undefined) { @@ -39,13 +39,14 @@ exports.newBotProfileStats = function newBotProfileStats() { function execute() { return { + "userProfileId": thisObject.profile.userProfileId, "botProfileId": thisObject.profile.botProfileId, "botProfileHandle": thisObject.profile.botProfileHandle, - "followingCount": thisObject.profile.followingCount, - "followersCount": thisObject.profile.followersCount, + "followingCount": thisObject.profile.following.size, + "followersCount": thisObject.profile.followers.size, + "postsCount": thisObject.profile.posts.size, "emitterEventsCount": thisObject.profile.emitterEventsCount, - "targetEventsCount": thisObject.profile.targetEventsCount, - "postsCount": thisObject.profile.postsCount + "targetEventsCount": thisObject.profile.targetEventsCount } } } \ No newline at end of file diff --git a/Network/Queries/UserProfileStats.js b/Network/Queries/UserProfileStats.js index 383d39aab..a7fd8580b 100644 --- a/Network/Queries/UserProfileStats.js +++ b/Network/Queries/UserProfileStats.js @@ -26,7 +26,6 @@ exports.newUserProfileStats = function newUserProfileStats() { if (thisObject.profile === undefined) { throw ('Target User Profile Not Found.') } - } function execute() { @@ -36,12 +35,12 @@ exports.newUserProfileStats = function newUserProfileStats() { "userProfileHandle": thisObject.profile.userProfileHandle, "blockchainAccount": thisObject.profile.blockchainAccount, "ranking": thisObject.profile.ranking, - "followingCount": thisObject.profile.followingCount, - "followersCount": thisObject.profile.followersCount, + "followingCount": thisObject.profile.following.size, + "followersCount": thisObject.profile.followers.size, + "postsCount": thisObject.profile.posts.size, + "botsCount": thisObject.profile.bots.size, "emitterEventsCount": thisObject.profile.emitterEventsCount, - "targetEventsCount": thisObject.profile.targetEventsCount, - "postsCount": thisObject.profile.postsCount, - "botsCount": thisObject.profile.botsCount + "targetEventsCount": thisObject.profile.targetEventsCount } } } \ No newline at end of file diff --git a/Network/Query.js b/Network/Query.js index 6842871ee..f69f56841 100644 --- a/Network/Query.js +++ b/Network/Query.js @@ -1,5 +1,12 @@ exports.newQuery = function newQuery() { + /* + A Query is a call from a Network Client to + a Network Node with the purpose to get + relevant information from the Social Graph. + A Query does not produce changes + on the state of the Social Graph. + */ let thisObject = { query: undefined, queryType: undefined, diff --git a/Network/clientsInterface.js b/Network/clientsInterface.js index 66b4c0650..1cc17e4d6 100644 --- a/Network/clientsInterface.js +++ b/Network/clientsInterface.js @@ -26,12 +26,14 @@ exports.newClientInterface = function newClientInterface() { "eventType": 10, "emitterUserProfileId": "a8de78f0-c3e4-4a2a-b7e8-f659073969db", "targetUserProfileId": "a8de78f0-c3e4-4a2a-b7e8-f659073969db", + "emitterBotProfileId": "a8de78f0-c3e4-4a2a-b7e8-f659073969db", + "targetBBotProfileId": "a8de78f0-c3e4-4a2a-b7e8-f659073969db", "emitterPostHash": "a8de78f0-c3e4-4a2a-b7e8-f659073969db", "targetPostHash": "a8de78f0-c3e4-4a2a-b7e8-f659073969db", "timestamp": 124234234234, - "botId": "a8de78f0-c3e4-4a2a-b7e8-f659073969db", "botAsset": "BTC", - "botExchange": "Binance" + "botExchange": "Binance", + "botEnabled": true } */ @@ -56,10 +58,11 @@ exports.newClientInterface = function newClientInterface() { "targetUserProfileId": "a8de78f0-c3e4-4a2a-b7e8-f659073969db", "emitterUserProfileHandle": "Luis-Fernando-Molina", "targetUserProfileHandle": "Luis-Fernando-Molina", + "emitterBotProfileId": "a8de78f0-c3e4-4a2a-b7e8-f659073969db", + "targetBBotProfileId": "a8de78f0-c3e4-4a2a-b7e8-f659073969db", "emitterPostHash": "a8de78f0-c3e4-4a2a-b7e8-f659073969db", "targetPostHash": "a8de78f0-c3e4-4a2a-b7e8-f659073969db", "timestamp": 124234234234, - "botId": "a8de78f0-c3e4-4a2a-b7e8-f659073969db", "botAsset": "BTC", "botExchange": "Binance", "botEnabled": true,