Переглянути джерело

+prodid 9000...9006, ping reconnect

David 9 роки тому
батько
коміт
f20dac6fa8
1 змінених файлів з 3 додано та 1 видалено
  1. 3 1
      back/db.py

+ 3 - 1
back/db.py

@@ -8,6 +8,8 @@ class db():
 	def get_cursor(self):
 	def get_cursor(self):
 		if not self.conn.open:
 		if not self.conn.open:
 			self.connect()
 			self.connect()
+
+		self.conn.ping(reconnect=True)
 		try:
 		try:
 			cur = self.conn.cursor()
 			cur = self.conn.cursor()
 		except:
 		except:
@@ -67,7 +69,7 @@ class db():
 		ret=[]
 		ret=[]
 		if _id is None:
 		if _id is None:
 			cur = self.get_cursor()
 			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():
 			for row in cur.fetchall():
 				row["cantidad"]=0
 				row["cantidad"]=0
 				ret.append(row)
 				ret.append(row)