Pārlūkot izejas kodu

+prodid 9000...9006, ping reconnect

David 9 gadi atpakaļ
vecāks
revīzija
f20dac6fa8
1 mainītis faili ar 3 papildinājumiem un 1 dzēšanām
  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)