Commit 8156efc7 authored by Porter Libby's avatar Porter Libby
Browse files

add date and time + titles

parent 19b769d1
......@@ -553,6 +553,9 @@ function processReadings(readings){
if (current_data[j].recordtime = min || !out_node.recordtime){
out_node.Spot = current_data[j].spotid;
out_node.recordtime = current_data[j].recordtime;
out_node.tripname = current_data[j].tripname;
out_node.sitename = current_data[j].sitename;
out_node.sectorname = current_data[j].sectorname;
out_node.elevation = current_data[j].elevation;
out_node.longitude = current_data[j].longitude;
out_node.latitude = current_data[j].latitude;
......
......@@ -35,23 +35,32 @@ function createGraphReading(dataset, q_arr, color){
if (dataset != null){
// create title
var trip = q_arr[0];
var site = q_arr[1];
var sector = q_arr[2];
var trip = dataset[0].tripname;
var site = dataset[0].sitename;
var sector = dataset[0].sectorname;
var title = document.createElement('h');
title.innerHTML = "Trip " + trip + ", Site " + site + ", Sector " + sector;
title.innerHTML = "Spots from " + trip + ", " + site + ", " + sector;
parent.append(title);
const table = document.createElement('table');
var tableHTML = "";
var keys = Object.keys(dataset[0]);
var keys = ["Spot","Date","Time","elevation","longitude","latitude","accuracy","Accelerometer","Magnetic Field", "Pressure", "Step Counter", "Light"];
tableHTML += createTableHeader(keys);
for ( x = 0 ; x < dataset.length ; x++){
console.log(dataset[x]);
prop_arr = [];
for (y=0;y<keys.length;y++){
prop_arr.push(dataset[x][keys[y]]);
if (keys[y] == "Date"){
date = new Date(dataset[x]["recordtime"]);
prop_arr.push(date.getFullYear()+'-' + (date.getMonth()+1) + '-'+date.getDate());
prop_arr.push(date.toLocaleTimeString('en-US'));
y++;
}else{
prop_arr.push(dataset[x][keys[y]]);
}
}
tableHTML += createTableRow(prop_arr);
}
......
......@@ -77,9 +77,16 @@ const getReadingsDates = (request, response) => {
})
}
const getReadings = (request, response) => {
console.info("Database: SELECT tripid,siteid,sectorid,spotid,platformid,sensorid,(SELECT sensortype FROM fieldday_sensor where sensorid=fieldday_reading.sensorid),recordtime,latitude,longitude,elevation,accuracy,satellites,quality,value,value_2,value_3,value_4,value_5,value_6 from fieldday_reading where tripid="+ (request.query.tripid) +' and siteid='+ (request.query.siteid) +' and sectorid='+ request.query.sectorid + ' and spotid='+ request.query.spotid +';');
console.info("Database: SELECT tripid,(SELECT tripname from fieldday_trip where tripid=fieldday_reading.tripid),siteid,sectorid,spotid,platformid,sensorid,(SELECT sensortype FROM fieldday_sensor where sensorid=fieldday_reading.sensorid),recordtime,latitude,longitude,elevation,accuracy,satellites,quality,value,value_2,value_3,value_4,value_5,value_6 from fieldday_reading where tripid="+ (request.query.tripid) +' and siteid='+ (request.query.siteid) +' and sectorid='+ request.query.sectorid + ' and spotid='+ request.query.spotid +';');
var query = "SELECT tripid,"+
"(SELECT tripname from fieldday_trip where tripid=fieldday_reading.tripid),"+
"(SELECT sitename from fieldday_site where tripid=fieldday_reading.tripid and siteid=fieldday_reading.siteid),"+
"(SELECT sectorname from fieldday_sector where tripid=fieldday_reading.tripid and siteid=fieldday_reading.siteid and sectorid=fieldday_reading.sectorid),"+
"siteid,sectorid,spotid,platformid,sensorid,(SELECT sensortype FROM fieldday_sensor where sensorid=fieldday_reading.sensorid)"+
",recordtime,latitude,longitude,elevation,accuracy,satellites,quality,value,value_2,value_3,value_4,value_5,value_6 from fieldday_reading where "+
"tripid="+ (request.query.tripid) +' and siteid='+ (request.query.siteid) +' and sectorid='+ request.query.sectorid + ' and ';
var query = "SELECT tripid,siteid,sectorid,spotid,platformid,sensorid,(SELECT sensortype FROM fieldday_sensor where sensorid=fieldday_reading.sensorid),recordtime,latitude,longitude,elevation,accuracy,satellites,quality,value,value_2,value_3,value_4,value_5,value_6 from fieldday_reading where tripid="+ (request.query.tripid) +' and siteid='+ (request.query.siteid) +' and sectorid='+ request.query.sectorid + ' and ';
if (request.query.spotids.length > 1){
query += "(";
}
......
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