Fixes to allow a new Project to have globals without UI components
This commit is contained in:
1 parent
fc716b9d95
commit
85cc9c2c3d
11 files changed
+61
-32
No files matched your search
@@ -29,7 +29,7 @@ exports.newEvents = function newEvents() {
|
||||
function execute() {
|
||||
let response = []
|
||||
switch (thisObject.direction) {
|
||||
case NT.globals.constants.queries.DIRECTION_FUTURE: {
|
||||
case NT.globals.queryConstants.DIRECTION_FUTURE: {
|
||||
for (let i = thisObject.initialIndex; i < thisObject.initialIndex + thisObject.amountRequested; i++) {
|
||||
let event = NT.memory.arrays.EVENTS[i]
|
||||
if (event === undefined) { break }
|
||||
@@ -37,7 +37,7 @@ exports.newEvents = function newEvents() {
|
||||
}
|
||||
break
|
||||
}
|
||||
case NT.globals.constants.queries.DIRECTION_PAST: {
|
||||
case NT.globals.queryConstants.DIRECTION_PAST: {
|
||||
for (let i = thisObject.initialIndex; i > thisObject.initialIndex - thisObject.amountRequested; i--) {
|
||||
let event = NT.memory.arrays.EVENTS[i]
|
||||
if (event === undefined) { break }
|
||||
|
||||
@@ -39,7 +39,7 @@ exports.newPostReplies = function newPostReplies() {
|
||||
let array = Array.from(thisObject.post.replies)
|
||||
|
||||
switch (thisObject.direction) {
|
||||
case NT.globals.constants.queries.DIRECTION_FUTURE: {
|
||||
case NT.globals.queryConstants.DIRECTION_FUTURE: {
|
||||
for (let i = thisObject.initialIndex; i < thisObject.initialIndex + thisObject.amountRequested; i++) {
|
||||
let arrayItem = array[i]
|
||||
if (post === undefined) { break }
|
||||
@@ -47,7 +47,7 @@ exports.newPostReplies = function newPostReplies() {
|
||||
}
|
||||
break
|
||||
}
|
||||
case NT.globals.constants.queries.DIRECTION_PAST: {
|
||||
case NT.globals.queryConstants.DIRECTION_PAST: {
|
||||
for (let i = thisObject.initialIndex; i > thisObject.initialIndex - thisObject.amountRequested; i--) {
|
||||
let arrayItem = array[i]
|
||||
if (post === undefined) { break }
|
||||
|
||||
@@ -32,7 +32,7 @@ exports.newProfileFollowers = function newProfileFollowers() {
|
||||
let array = Array.from(thisObject.profile.followers)
|
||||
|
||||
switch (thisObject.direction) {
|
||||
case NT.globals.constants.queries.DIRECTION_FUTURE: {
|
||||
case NT.globals.queryConstants.DIRECTION_FUTURE: {
|
||||
for (let i = thisObject.initialIndex; i < thisObject.initialIndex + thisObject.amountRequested; i++) {
|
||||
let arrayItem = array[i]
|
||||
if (arrayItem === undefined) { break }
|
||||
@@ -40,7 +40,7 @@ exports.newProfileFollowers = function newProfileFollowers() {
|
||||
}
|
||||
break
|
||||
}
|
||||
case NT.globals.constants.queries.DIRECTION_PAST: {
|
||||
case NT.globals.queryConstants.DIRECTION_PAST: {
|
||||
for (let i = thisObject.initialIndex; i > thisObject.initialIndex - thisObject.amountRequested; i--) {
|
||||
let arrayItem = array[i]
|
||||
if (arrayItem === undefined) { break }
|
||||
|
||||
@@ -32,7 +32,7 @@ exports.newProfileFollowing = function newProfileFollowing() {
|
||||
let array = Array.from(thisObject.profile.following)
|
||||
|
||||
switch (thisObject.direction) {
|
||||
case NT.globals.constants.queries.DIRECTION_FUTURE: {
|
||||
case NT.globals.queryConstants.DIRECTION_FUTURE: {
|
||||
for (let i = thisObject.initialIndex; i < thisObject.initialIndex + thisObject.amountRequested; i++) {
|
||||
let arrayItem = array[i]
|
||||
if (arrayItem === undefined) { break }
|
||||
@@ -40,7 +40,7 @@ exports.newProfileFollowing = function newProfileFollowing() {
|
||||
}
|
||||
break
|
||||
}
|
||||
case NT.globals.constants.queries.DIRECTION_PAST: {
|
||||
case NT.globals.queryConstants.DIRECTION_PAST: {
|
||||
for (let i = thisObject.initialIndex; i > thisObject.initialIndex - thisObject.amountRequested; i--) {
|
||||
let arrayItem = array[i]
|
||||
if (arrayItem === undefined) { break }
|
||||
|
||||
@@ -35,7 +35,7 @@ exports.newProfilePosts = function newProfilePosts() {
|
||||
let array = Array.from(thisObject.profile.posts)
|
||||
|
||||
switch (thisObject.direction) {
|
||||
case NT.globals.constants.queries.DIRECTION_FUTURE: {
|
||||
case NT.globals.queryConstants.DIRECTION_FUTURE: {
|
||||
for (let i = thisObject.initialIndex; i < thisObject.initialIndex + thisObject.amountRequested; i++) {
|
||||
let arrayItem = array[i]
|
||||
if (arrayItem === undefined) { break }
|
||||
@@ -43,7 +43,7 @@ exports.newProfilePosts = function newProfilePosts() {
|
||||
}
|
||||
break
|
||||
}
|
||||
case NT.globals.constants.queries.DIRECTION_PAST: {
|
||||
case NT.globals.queryConstants.DIRECTION_PAST: {
|
||||
for (let i = thisObject.initialIndex; i > thisObject.initialIndex - thisObject.amountRequested; i--) {
|
||||
let arrayItem = array[i]
|
||||
if (arrayItem === undefined) { break }
|
||||
|
||||
@@ -28,18 +28,6 @@ global.NT = {
|
||||
},
|
||||
utilities: {
|
||||
queriesValidations: require('./Utilities/QueriesValidations.js').newQueriesValidations()
|
||||
},
|
||||
globals: {
|
||||
constants: {
|
||||
queries: {
|
||||
INITIAL_INDEX_FIRST: 'First',
|
||||
INITIAL_INDEX_LAST: 'Last',
|
||||
MIN_AMOUNT_REQUESTED: 1,
|
||||
MAX_AMOUNT_REQUESTED: 100,
|
||||
DIRECTION_FUTURE: 'Future',
|
||||
DIRECTION_PAST: 'Past'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
|
||||
@@ -51,11 +51,11 @@ exports.newQueriesValidations = function newQueriesValidations() {
|
||||
throw ('Initial Index Undefined.')
|
||||
}
|
||||
|
||||
if (queryReceived.initialIndex === NT.globals.constants.queries.INITIAL_INDEX_LAST) {
|
||||
if (queryReceived.initialIndex === NT.globals.queryConstants.INITIAL_INDEX_LAST) {
|
||||
queryReceived.initialIndex = thisObject.profile.posts.length - 1
|
||||
}
|
||||
|
||||
if (queryReceived.initialIndex === NT.globals.constants.queries.INITIAL_INDEX_FIRST) {
|
||||
if (queryReceived.initialIndex === NT.globals.queryConstants.INITIAL_INDEX_FIRST) {
|
||||
queryReceived.initialIndex = 0
|
||||
}
|
||||
|
||||
@@ -75,11 +75,11 @@ exports.newQueriesValidations = function newQueriesValidations() {
|
||||
throw ('Amount Requested Is Not a Number.')
|
||||
}
|
||||
|
||||
if (queryReceived.amountRequested < NT.globals.constants.queries.MIN_AMOUNT_REQUESTED) {
|
||||
if (queryReceived.amountRequested < NT.globals.queryConstants.MIN_AMOUNT_REQUESTED) {
|
||||
throw ('Amount Requested Below Min.')
|
||||
}
|
||||
|
||||
if (queryReceived.amountRequested > NT.globals.constants.queries.MAX_AMOUNT_REQUESTED) {
|
||||
if (queryReceived.amountRequested > NT.globals.queryConstants.MAX_AMOUNT_REQUESTED) {
|
||||
throw ('Amount Requested Above Max.')
|
||||
}
|
||||
/*
|
||||
@@ -89,7 +89,7 @@ exports.newQueriesValidations = function newQueriesValidations() {
|
||||
throw ('Direction Undefined.')
|
||||
}
|
||||
|
||||
if (queryReceived.direction !== NT.globals.constants.queries.DIRECTION_FUTURE && queryReceived.direction !== NT.globals.constants.queries.DIRECTION_PAST) {
|
||||
if (queryReceived.direction !== NT.globals.queryConstants.DIRECTION_FUTURE && queryReceived.direction !== NT.globals.queryConstants.DIRECTION_PAST) {
|
||||
throw ('Direction Not Supported.')
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user