diff --git a/html/engine.js b/html/engine.js index 03aea00..6c5e187 100644 --- a/html/engine.js +++ b/html/engine.js @@ -36,7 +36,7 @@ function update(data) { let section = parseInt(data.direction/45 + 0.5); section = section % 8; console.log(arrows[section]); - const text = `${data.time}
height: ${data.height}
speed: ${speed}
direction: ${arrows[section]} ${data.direction}`; + const text = `time: ${data.time}
latitude: ${data.latitude}
longitude: ${data.longitude}
height: ${data.height}
speed: ${speed}
direction: ${arrows[section]} ${data.direction}`; if (!map) { create_map(coords); } else { diff --git a/src/db.rs b/src/db.rs index 6f0c131..e50da29 100644 --- a/src/db.rs +++ b/src/db.rs @@ -19,21 +19,21 @@ CREATE INDEX idx_time const QUERY_INSERT: &'static str = " INSERT INTO log ( time, - serial, latitude, longitude, speed, height, - direction + direction, + serial ) VALUES ( :time, - :serial, :latitude, :longitude, :speed, :height, - :direction + :direction, + :serial )"; pub fn connectdb() -> Result { @@ -69,13 +69,13 @@ pub fn prepare_insert(conn: &Connection) -> Statement { pub fn insert(conn: &Connection, dblog: &DbLog) -> Result<()> { let mut stmt = prepare_insert(&conn); match stmt.execute(params![ - dblog.serial, dblog.time, dblog.latitude, dblog.longitude, dblog.speed, dblog.height, dblog.direction, + dblog.serial, ]) { Ok(i) => println!("{} rows were inserted", i), Err(err) => println!("insert failed: {}", err), @@ -84,13 +84,13 @@ pub fn insert(conn: &Connection, dblog: &DbLog) -> Result<()> { } pub struct DbLog { - pub serial: u16, pub time: String, pub latitude: f64, pub longitude: f64, pub speed: u16, pub height: u16, pub direction: u16, + pub serial: u16, } impl ToSql for DbLog {