|
|
@ -60,19 +60,20 @@ $(function() {
|
|
|
|
contentType: "application/json",
|
|
|
|
contentType: "application/json",
|
|
|
|
async: false,
|
|
|
|
async: false,
|
|
|
|
success: function(data) {
|
|
|
|
success: function(data) {
|
|
|
|
var duration = data[0].duration / 60000; // Convert to minutes
|
|
|
|
if(typeof data[0].duration == 'undefined'){
|
|
|
|
var newData = [{
|
|
|
|
console.log("Currently data can't be retrieved...");
|
|
|
|
|
|
|
|
console.log(JSON.stringify(data));
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
var duration = data[0].duration / 60000; // Convert to minutes
|
|
|
|
|
|
|
|
var newData = [{
|
|
|
|
"duration": duration,
|
|
|
|
"duration": duration,
|
|
|
|
"owner": "YES"
|
|
|
|
"owner": "YES"
|
|
|
|
}, {
|
|
|
|
}, {
|
|
|
|
"duration": (1440 - duration),
|
|
|
|
"duration": (1440 - duration),
|
|
|
|
"owner": "NO"
|
|
|
|
"owner": "NO"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
];
|
|
|
|
];
|
|
|
|
// data.forEach(function(entry) {
|
|
|
|
}
|
|
|
|
// entry.duration = entry.duration / 60000 % 100; // Convert to minutes
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
// providerData = data;
|
|
|
|
|
|
|
|
providerData = newData;
|
|
|
|
providerData = newData;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
@ -81,18 +82,15 @@ $(function() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var drawGadget = function() {
|
|
|
|
var drawGadget = function() {
|
|
|
|
|
|
|
|
|
|
|
|
draw('#canvas', conf[CHART_CONF], schema, providerData);
|
|
|
|
draw('#canvas', conf[CHART_CONF], schema, providerData);
|
|
|
|
setInterval(function() {
|
|
|
|
setInterval(function() {
|
|
|
|
draw('#canvas', conf[CHART_CONF], schema, getProviderData());
|
|
|
|
draw('#canvas', conf[CHART_CONF], schema, getProviderData());
|
|
|
|
}, pref.getInt(REFRESH_INTERVAL));
|
|
|
|
}, pref.getInt(REFRESH_INTERVAL));
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
getGadgetLocation(function(gadget_Location) {
|
|
|
|
getGadgetLocation(function(gadget_Location) {
|
|
|
|
gadgetLocation = gadget_Location;
|
|
|
|
gadgetLocation = gadget_Location;
|
|
|
|
init();
|
|
|
|
init();
|
|
|
|
drawGadget();
|
|
|
|
drawGadget();
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|