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

View File

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

View File

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