alsmanager_lib 1.0.63 → 1.0.65

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/modules.js +8 -6
  2. package/package.json +1 -1
package/lib/modules.js CHANGED
@@ -1492,35 +1492,37 @@ function queryDeviceByIdentificativo(db_used, identificativo) {
1492
1492
 
1493
1493
  //Get Device Status
1494
1494
  function queryDeviceStatusSQLite(id_device, date_ref) {
1495
- var query = "select case when status is null then 0 else status end as stato, MAX(date_status), count(*) as num from device_usage du ";
1495
+ var query = "select case when status is null then 0 else status end as stato, date_status from device_usage du ";
1496
1496
  query += "where du.id_device = " + id_device + " ";
1497
1497
  if (date_ref) {
1498
1498
  switch (date_ref) {
1499
1499
  case "current":
1500
- query += "and date('now') >= du.date_status";
1500
+ query += "and date('now') >= du.date_status ";
1501
1501
  break;
1502
1502
  default:
1503
- query += "and '" + date_ref + "' >= du.date_status";
1503
+ query += "and '" + date_ref + "' >= du.date_status ";
1504
1504
  break;
1505
1505
 
1506
1506
  }
1507
1507
  }
1508
+ query += "order by id desc limit 1"
1508
1509
  return query;
1509
1510
  }
1510
1511
  function queryDeviceStatusMySQL(id_device, date_ref) {
1511
- var query = "select case when status is null then 0 else status end as stato, MAX(date_status), count(*) as num from device_usage du ";
1512
+ var query = "select case when status is null then 0 else status end as stato, date_status from device_usage du ";
1512
1513
  query += "where du.id_device = :id_device ";
1513
1514
  if (date_ref) {
1514
1515
  switch (date_ref) {
1515
1516
  case "current":
1516
- query += "and (CURDATE() >= du.date_status";
1517
+ query += "and (CURDATE() >= du.date_status ";
1517
1518
  break;
1518
1519
  default:
1519
- query += "and :date_ref >= du.date_status";
1520
+ query += "and :date_ref >= du.date_status ";
1520
1521
  break;
1521
1522
 
1522
1523
  }
1523
1524
  }
1525
+ query += "order by id desc limit 1"
1524
1526
  return query;
1525
1527
  }
1526
1528
  function queryDeviceStatus(db_used, id_device, date_ref) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "alsmanager_lib",
3
- "version": "1.0.63",
3
+ "version": "1.0.65",
4
4
  "description": "Funzioni per ALSManager",
5
5
  "license": "ISC",
6
6
  "author": "Luca Cattani",