Selaa lähdekoodia

+prodid 9000...9006, ping reconnect

David 9 vuotta sitten
vanhempi
commit
f20dac6fa8
1 muutettua tiedostoa jossa 3 lisäystä ja 1 poistoa
  1. 3 1
      back/db.py

+ 3 - 1
back/db.py

@@ -8,6 +8,8 @@ class db():
 	def get_cursor(self):
 		if not self.conn.open:
 			self.connect()
+
+		self.conn.ping(reconnect=True)
 		try:
 			cur = self.conn.cursor()
 		except:
@@ -67,7 +69,7 @@ class db():
 		ret=[]
 		if _id is None:
 			cur = self.get_cursor()
-			cur.execute("SELECT id, nombre, precio, stock > 0 as disponible, stock < 25 as low, stock FROM productos where id between 1000 and 2999 and id not in (1019, 1014, 2014, 1015, 2015, 1047, 2038, 2030)")
+			cur.execute("SELECT id, nombre, precio, stock > 0 as disponible, stock < 25 as low, stock FROM productos where (id between 1000 and 2999 and id not in (1019, 1014, 2014, 1015, 2015, 1047, 2038, 2030)) or (id between 9000 and 9006)")
 			for row in cur.fetchall():
 				row["cantidad"]=0
 				ret.append(row)