alsmanager_lib 3.0.114 → 3.0.116

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 +16 -6
  2. package/package.json +1 -1
package/lib/modules.js CHANGED
@@ -11151,7 +11151,7 @@ function updateSite(id_site, id_place, mark, floor, size) {
11151
11151
 
11152
11152
  function writeSiteDestination(id_site, id_place, date_start, date_end, name, funzione) {
11153
11153
  var dt_start = convertDateToStringDB(date_start);
11154
- var dt_end = '2999-12-31';
11154
+ var dt_end = convertDateToStringDB(date_end);
11155
11155
 
11156
11156
  var query = "insert into site_destinations (id_site, id_place, date_start, date_end, name, type) values ";
11157
11157
  query += "(" + id_site + ", ";
@@ -11168,8 +11168,8 @@ function updateSiteDestination(id_site, id_place, date_start, date_end, name, fu
11168
11168
  var dt_end = convertDateToStringDB(date_end);
11169
11169
 
11170
11170
  var query = "update site_destinations set ";
11171
- query += "'" + dt_start + "', ";
11172
- query += "'" + dt_end + "' ";
11171
+ query += "date_start = '" + dt_start + "', ";
11172
+ query += "date_end = '" + dt_end + "' ";
11173
11173
  if (name) {
11174
11174
  query += ", name = '" + name + "', ";
11175
11175
  }
@@ -11181,11 +11181,9 @@ function updateSiteDestination(id_site, id_place, date_start, date_end, name, fu
11181
11181
  }
11182
11182
 
11183
11183
  function updateSiteDestinationAfterMove(id_site, id_place, date_start_ref) {
11184
- var dt_start = convertDateToStringDB(date_start);
11185
11184
  var dt_end = convertDateToStringDB(date_start_ref);
11186
-
11187
11185
  var query = "update site_destinations set ";
11188
- query += "date('" + dt_end + "', '-1 day') ";
11186
+ query += "date_end = date('" + dt_end + "', '-1 day') ";
11189
11187
  query += "where id_site = " + id_site + " and id_place = '" + id_place + "'";
11190
11188
  return query;
11191
11189
  }
@@ -11197,6 +11195,17 @@ function getSiteDestinationsByIdSite(id_site, id_place) {
11197
11195
  return query;
11198
11196
  }
11199
11197
 
11198
+ function getLastSiteDestinationsByIdSite(id_site, id_place, date_ref) {
11199
+ var dt_ref = convertDateToStringDB(date_ref);
11200
+ var query = "select date_start, date_end, name, type from site_destinations ";
11201
+ query += "where id_site = " + id_site + " and id_place = '" + id_place + "' ";
11202
+ if (date_ref) {
11203
+ query += "and date('" + dt_ref + "') >= date_start and date('" + dt_ref + "') <= date_end ";
11204
+ }
11205
+ query += "order by date_start desc LIMIT 1";
11206
+ return query;
11207
+ }
11208
+
11200
11209
 
11201
11210
  //Sites by devices
11202
11211
  function getSitesFromDeviceSQLite(id_device, prec_pos) {
@@ -15197,6 +15206,7 @@ module.exports = {
15197
15206
  updateSiteDestination,
15198
15207
  updateSiteDestinationAfterMove,
15199
15208
  getSiteDestinationsByIdSite,
15209
+ getLastSiteDestinationsByIdSite,
15200
15210
  getSitesFromDevice,
15201
15211
  getSitesWithDatesFromDevice,
15202
15212
  querySitesWithDefaults,
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  ".": "./lib/modules.js",
5
5
  "./dbconn": "./lib/dbconn.js"
6
6
  },
7
- "version": "3.0.114",
7
+ "version": "3.0.116",
8
8
  "description": "Funzioni per ALSManager",
9
9
  "license": "ISC",
10
10
  "author": "Luca Cattani",