Commit 3f3ecd24 authored by Porter Libby's avatar Porter Libby
Browse files

add host subcount

parent 1078fe75
......@@ -330,12 +330,14 @@ function getStreamingsHosts(sector_id){
data: {sectorid: sector_id, siteid: query_selection[1], tripid: query_selection[0]},
success: function(response) {
var hosts = [];
var s_count = [];
for(x = 0; x < response.length; x++){
hosts.push(response[x]);
s_count.push(response[x].s_count)
}
console.info('DATA - HOSTS');
console.table(response);
renderStreamingsHosts(hosts);
renderStreamingsHosts(hosts, s_count);
},
error: function(xhr, status, err) {
console.log(xhr.responseText);
......@@ -527,7 +529,7 @@ function renderSpots(spotids, r_count, s_count){
document.getElementById('data-prompt').innerHTML = "No Spots found for this sector"
}
}
function renderStreamingsHosts(hosts){
function renderStreamingsHosts(hosts,s_count){
if (streamings.length != 0){
var container = document.getElementById('streaminghost');
container.innerHTML = "";
......@@ -539,7 +541,7 @@ function renderStreamingsHosts(hosts){
if (hosts[x].hostname){
hostname = hosts[x].hostname.toString()
}
var elem = createRadioElementStreamingsHosts((x % 2),'hosts', false, hosts[x].hostid, hostname ); // util function
var elem = createRadioElementStreamingsHosts((x % 2),'hosts', s_count[x], hosts[x].hostid, hostname ); // util function
streamingshosts_ls.innerHTML += elem;
}
container.append(streamingshosts_ls);
......
......@@ -114,9 +114,9 @@ function createRadioElementSpots( mode, name, count, label,id ) {
return radioHtml;
}
function createRadioElementStreamingsHosts( mode, name, checked, id, label ) {
function createRadioElementStreamingsHosts( mode, name, count, id, label ) {
var f = "getStreamingsPlatforms";
return createRadioElement(name, id, label, f);
return createRadioElement(name, id, label, f, count);
}
function createRadioElementStreamingsPlatforms( mode, name, checked, id, label ) {
var f = "getStreamingsDates";
......
......@@ -145,6 +145,7 @@ const getReadings = (request, response) => {
}
const getStreamingsHosts = (request, response) => {
var query = 'SELECT DISTINCT hostid, '
+ "(SELECT COUNT(*) FROM fieldday_streaming WHERE tripid="+ (request.query.tripid) + ' and siteid=' + (request.query.siteid) + " AND sectorid=" + request.query.sectorid + " AND hostid=fieldday_host.hostid) AS s_count, "
+'(SELECT DISTINCT hostname FROM fieldday_host_temp where hostid=fieldday_streaming.hostid)'
+' FROM fieldday_streaming where tripid='+ (request.query.tripid)
+' and siteid='+ (request.query.siteid)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment