Superalgos Network: Query User Profiles debugged

This commit is contained in:
Luis Fernando Molina committed 2021-09-03 12:23:42 +02:00
1 parent 2645df775e
commit 67ec986422
13 files changed
+266 -227

No files matched your search

@@ -4,6 +4,7 @@ exports.newSocialTradingModulesQueriesProfileFollowing = function newSocialTradi
all the User or Bot profiles that are being followed by a certain User or Bot profile.
*/
let thisObject = {
array: undefined,
profile: undefined,
initialIndex: undefined,
amountRequested: undefined,
@@ -16,25 +17,27 @@ exports.newSocialTradingModulesQueriesProfileFollowing = function newSocialTradi
return thisObject
function finalize() {
thisObject.array = undefined
thisObject.profile = undefined
}
function initialize(queryReceived) {
NT.utilities.queriesValidations.profilesValidations(queryReceived, thisObject)
NT.utilities.queriesValidations.arrayValidations(queryReceived, thisObject)
thisObject.array = Array.from(thisObject.profile.following)
NT.projects.socialTrading.utilities.queriesValidations.profilesValidations(queryReceived, thisObject)
NT.projects.socialTrading.utilities.queriesValidations.arrayValidations(queryReceived, thisObject, thisObject.array)
}
function execute() {
let response = []
let array = Array.from(thisObject.profile.following)
switch (thisObject.direction) {
case NT.projects.socialTrading.globals.queryConstants.DIRECTION_FUTURE: {
for (let i = thisObject.initialIndex; i < thisObject.initialIndex + thisObject.amountRequested; i++) {
let arrayItem = array[i]
let arrayItem = thisObject.array[i]
if (arrayItem === undefined) { break }
addToResponse(arrayItem)
}
@@ -42,7 +45,7 @@ exports.newSocialTradingModulesQueriesProfileFollowing = function newSocialTradi
}
case NT.projects.socialTrading.globals.queryConstants.DIRECTION_PAST: {
for (let i = thisObject.initialIndex; i > thisObject.initialIndex - thisObject.amountRequested; i--) {
let arrayItem = array[i]
let arrayItem = thisObject.array[i]
if (arrayItem === undefined) { break }
addToResponse(arrayItem)
}