From 127d4261f1fd02baa84157092a413409d256736d Mon Sep 17 00:00:00 2001 From: Alfonso Solbes Date: Sat, 31 Dec 2016 20:31:27 +0100 Subject: [PATCH 1/2] fixes problem filtering numeric fields --- Code/QT/PantallaPGN.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Code/QT/PantallaPGN.py b/Code/QT/PantallaPGN.py index f050836..f35671e 100644 --- a/Code/QT/PantallaPGN.py +++ b/Code/QT/PantallaPGN.py @@ -751,7 +751,7 @@ def aceptar(self): if campo == "PLIES": valor = valor.strip() if valor.isdigit(): - valor = "%3d" % int(valor) + valor = "%d" % int(valor) if par0: npar += 1 if par1: @@ -791,9 +791,11 @@ def where(self): else: valor = valor.upper() if valor.isupper(): - where += "UPPER(%s) %s '%s'" % (campo, condicion, valor.upper()) + where += "UPPER(%s) %s '%s'" % (campo, condicion, valor) + elif valor.isdigit(): + where += "CAST(%s as decimal) %s %s" % (campo, condicion, valor) else: - where += "%s %s '%s'" % (campo, condicion, valor.upper()) + where += "%s %s '%s'" % (campo, condicion, valor) if par1: where += ")" return where From 63b7f5dd7a5e506e01dd831f7bbc55e479e22cce Mon Sep 17 00:00:00 2001 From: Alfonso Solbes Date: Mon, 2 Jan 2017 17:19:23 +0100 Subject: [PATCH 2/2] fixes small bugs related to analysis --- Code/ControlPGN.py | 4 +++- Code/QT/Histogram.py | 10 ++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Code/ControlPGN.py b/Code/ControlPGN.py index 1b60525..94dd222 100644 --- a/Code/ControlPGN.py +++ b/Code/ControlPGN.py @@ -158,8 +158,10 @@ def actual(self): rival = self.gestor.libro.nombre elif tipoJuego in (kJugFics, kJugFide): rival = self.gestor.nombreObj - else: + elif self.gestor.xrival: rival = self.gestor.xrival.nombre + else: + rival = ""; jugador = self.gestor.configuracion.jugador resultado = self.gestor.resultado diff --git a/Code/QT/Histogram.py b/Code/QT/Histogram.py index 49dc296..f7afb0f 100644 --- a/Code/QT/Histogram.py +++ b/Code/QT/Histogram.py @@ -431,8 +431,14 @@ def genHistograms(partida, sicentipawns): alm.lijgB = lijgB alm.porcT = porcT*1.0/len(lijg) - alm.porcW = porcW*1.0/len(lijgW) - alm.porcB = porcB*1.0/len(lijgB) + if len(lijgW) != 0: + alm.porcW = porcW*1.0/len(lijgW) + else: + alm.porcW = 0; + if len(lijgB) != 0: + alm.porcB = porcB*1.0/len(lijgB) + else: + alm.porcB = 0; return alm