I'm not sure what's going wrong here / how I can fix it.
Parse.Cloud.job("expireTimes", function(request, response) {
var currentTime = new Date().getTime() / 1000;
var Wait = Parse.Object.extend("Wait");
Parse.Object.registerSubclass("Wait", Wait);
var query = new Parse.Query(Wait);
query.select(["times", "timestamp"]);
query.find({
success: function(results) {
for (var i = 0; i < timestamps.length; i++) {
if (currentTime >= timestamps[i] + 60) {
// Delete old wait times
timestamps.splice(i, 1);
times.splice(i, 1);
i--;
} else {
break;
}
};
response.success("Got " + results.length + " Query results: " + results[0].objectId);
},
error: function(error) {
response.error("Request failed with response code");
console.error("Request failed with response code ");
}
});
});
It tell's me that timestamps is undefined:
I2015-11-27T17:00:03.419Z]Deployed v17 with triggers:
Jobs:
expireTimes
E2015-11-27T17:01:04.489Z]v17 Ran job expireTimes with:
Input: {}
Result: ReferenceError: timestamps is not defined
at e.query.find.success (main.js:9:24)
at e.<anonymous> (Parse.js:14:28224)
at e.s (Parse.js:14:27156)
at e.n.value (Parse.js:14:26575)
at e.s (Parse.js:14:27284)
at e.n.value (Parse.js:14:26575)
at e.s (Parse.js:14:27284)
at e.n.value (Parse.js:14:26575)
at e.<anonymous> (Parse.js:14:27228)
at e.s (Parse.js:14:27156)
Not sure what this means / how to fix it. I would assume declare timestamps, but I thought that was already done with the retrieval of the arrays in the columns "times" and "timestamp"
Any help would be much appreciated. Thank you