fix: corregir bugs que costaban minutos y tapaban errores
- google_calendar: RefreshError se referenciaba como google.oauth2.credentials.exceptions.RefreshError, ruta que no existe. Al fallar un refresh de token saltaba un AttributeError que ocultaba el error real y rompia el re-auth. Ahora se importa de google.auth.exceptions. - google_calendar: getEvent() comprobaba si habia un evento activo en ese instante. El daemon planifica de madrugada, asi que una ausencia de 09:00 a 18:00 no se detectaba y se fichaba igual. Ahora acepta un dia y comprueba solapamiento. Sin argumento mantiene el comportamiento anterior. - google_calendar: datetime.utcnow() esta deprecado en Python 3.12+. - timenet_manager: "args.basedtime and not args.type" ignoraba -t 0 (Entrada) al combinarlo con -bt, porque not 0 es True. Ahora es "args.type is None". - timenet_manager: updateVersion() asignaba el objeto Response al header Tn-V en vez de su texto. - timenet_manager: geo.accuracy se parseaba y se podia sobrescribir por CLI pero nunca se enviaba en el payload de cp/checks. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -180,7 +180,11 @@ class timenetManager:
|
||||
self.headers["dStr"] = "\"" + now.strftime("%d/%m/%Y %H:%M:%S") + "\""
|
||||
|
||||
def updateVersion(self):
|
||||
self.headers[strings.tnv_string] = self.getVersion()
|
||||
response = self.getVersion()
|
||||
if response.status_code != 200:
|
||||
logger.warning(f"No se pudo obtener la version: status_code={response.status_code}")
|
||||
return
|
||||
self.headers[strings.tnv_string] = response.text.replace("\"", "")
|
||||
|
||||
def getVersion(self):
|
||||
self.updateTime()
|
||||
@@ -258,7 +262,7 @@ class timenetManager:
|
||||
# Determinar tipo de fichaje
|
||||
typ = 0
|
||||
try:
|
||||
if args.basedtime and not args.type:
|
||||
if args.basedtime and args.type is None:
|
||||
hour = datetime.now().strftime("%H")
|
||||
logger.info(f"Hora actual: {hour}")
|
||||
|
||||
@@ -312,6 +316,7 @@ class timenetManager:
|
||||
"date": self.headers[strings.tnd_string],
|
||||
"geoLatitude": config.get('geo', {}).get('latitude', ''),
|
||||
"geoLongitude": config.get('geo', {}).get('longitude', ''),
|
||||
"geoAccuracy": config.get('geo', {}).get('accuracy', ''),
|
||||
"geoError": "",
|
||||
"dStr": self.headers["dStr"].replace("\"", "")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user