Small log tests

This commit is contained in:
Kasper Rynning-Tønnesen
2019-02-28 08:27:12 +01:00
parent f5a992dde0
commit 604d7f5b83
3 changed files with 7 additions and 2 deletions

View File

@@ -320,6 +320,7 @@ function add_function(arr, coll, guid, offline, socket) {
if(typeof(arr) === 'object' && arr !== undefined && arr !== null && arr !== "" && !isNaN(parseInt(arr.duration)))
{
if(coll == "" || coll == undefined || coll == null || !arr.hasOwnProperty("duration")) {
console.log(1, arr);
var result = {
start: {
expected: "number or string that can be cast to int",
@@ -339,6 +340,7 @@ function add_function(arr, coll, guid, offline, socket) {
if(arr.end == undefined) arr.end = parseInt(arr.duration);
var start = parseInt(arr.start);
var end = parseInt(arr.end);
console.log(2, arr);
if(start < 0) {
socket.emit("toast", "faulty_start_end");
return;
@@ -352,6 +354,7 @@ function add_function(arr, coll, guid, offline, socket) {
arr.duration = end - start;
}
} catch(e) {
console.log(3, arr);
return;
}
@@ -399,6 +402,7 @@ function add_function(arr, coll, guid, offline, socket) {
got: arr.hasOwnProperty("thumbnail") ? typeof(arr.thumbnail) : undefined
}
};
console.log(4, arr);
socket.emit('update_required', result);
return;
}
@@ -527,6 +531,7 @@ function add_function(arr, coll, guid, offline, socket) {
got: arr.hasOwnProperty("duration") ? typeof(arr.duration) : undefined,
}
};
console.log(5, arr);
socket.emit('update_required', result);
}
}

View File

@@ -167,7 +167,7 @@ var Channel = {
no_socket = false;
socket = io.connect(''+add+':8080', connection_options);
socket.on('update_required', function(msg) {
if(window.location.hostname == "localhost") {
if(window.location.hostname == "localhost" || debug == true) {
console.error(msg);
return;
}

View File

@@ -464,7 +464,7 @@ var Frontpage = {
no_socket = false;
socket = io.connect(''+add+':8080', connection_options);
socket.on('update_required', function(msg) {
if(window.location.hostname == "localhost") {
if(window.location.hostname == "localhost" || debug == true) {
console.log(msg);
return;
}