develop #1
@@ -1292,18 +1292,20 @@ def get_dashboard_data(
|
||||
|
||||
# Aplicar filtros de fecha
|
||||
if start_date:
|
||||
# Parsear fecha y establecer al inicio del día en UTC
|
||||
# Parsear fecha y establecer al inicio del día en UTC-3
|
||||
from datetime import timezone
|
||||
local_tz = timezone(timedelta(hours=-3))
|
||||
start = datetime.fromisoformat(start_date).replace(hour=0, minute=0, second=0, microsecond=0)
|
||||
if start.tzinfo is None:
|
||||
start = start.replace(tzinfo=timezone.utc)
|
||||
start = start.replace(tzinfo=local_tz)
|
||||
query = query.filter(models.Inspection.started_at >= start)
|
||||
if end_date:
|
||||
# Parsear fecha y establecer al final del día en UTC
|
||||
# Parsear fecha y establecer al final del día en UTC-3
|
||||
from datetime import timezone
|
||||
local_tz = timezone(timedelta(hours=-3))
|
||||
end = datetime.fromisoformat(end_date).replace(hour=23, minute=59, second=59, microsecond=999999)
|
||||
if end.tzinfo is None:
|
||||
end = end.replace(tzinfo=timezone.utc)
|
||||
end = end.replace(tzinfo=local_tz)
|
||||
query = query.filter(models.Inspection.started_at <= end)
|
||||
|
||||
# Filtro por mecánico
|
||||
@@ -1336,15 +1338,17 @@ def get_dashboard_data(
|
||||
|
||||
if start_date:
|
||||
from datetime import timezone
|
||||
local_tz = timezone(timedelta(hours=-3))
|
||||
start = datetime.fromisoformat(start_date).replace(hour=0, minute=0, second=0, microsecond=0)
|
||||
if start.tzinfo is None:
|
||||
start = start.replace(tzinfo=timezone.utc)
|
||||
start = start.replace(tzinfo=local_tz)
|
||||
flagged_items = flagged_items.filter(models.Inspection.started_at >= start)
|
||||
if end_date:
|
||||
from datetime import timezone
|
||||
local_tz = timezone(timedelta(hours=-3))
|
||||
end = datetime.fromisoformat(end_date).replace(hour=23, minute=59, second=59, microsecond=999999)
|
||||
if end.tzinfo is None:
|
||||
end = end.replace(tzinfo=timezone.utc)
|
||||
end = end.replace(tzinfo=local_tz)
|
||||
flagged_items = flagged_items.filter(models.Inspection.started_at <= end)
|
||||
if mechanic_id:
|
||||
flagged_items = flagged_items.filter(models.Inspection.mechanic_id == mechanic_id)
|
||||
@@ -1379,15 +1383,17 @@ def get_dashboard_data(
|
||||
|
||||
if start_date:
|
||||
from datetime import timezone
|
||||
local_tz = timezone(timedelta(hours=-3))
|
||||
start = datetime.fromisoformat(start_date).replace(hour=0, minute=0, second=0, microsecond=0)
|
||||
if start.tzinfo is None:
|
||||
start = start.replace(tzinfo=timezone.utc)
|
||||
start = start.replace(tzinfo=local_tz)
|
||||
mechanic_stats = mechanic_stats.filter(models.Inspection.started_at >= start)
|
||||
if end_date:
|
||||
from datetime import timezone
|
||||
local_tz = timezone(timedelta(hours=-3))
|
||||
end = datetime.fromisoformat(end_date).replace(hour=23, minute=59, second=59, microsecond=999999)
|
||||
if end.tzinfo is None:
|
||||
end = end.replace(tzinfo=timezone.utc)
|
||||
end = end.replace(tzinfo=local_tz)
|
||||
mechanic_stats = mechanic_stats.filter(models.Inspection.started_at <= end)
|
||||
|
||||
mechanic_stats = mechanic_stats.group_by(models.User.id, models.User.full_name)\
|
||||
@@ -1422,15 +1428,17 @@ def get_dashboard_data(
|
||||
|
||||
if start_date:
|
||||
from datetime import timezone
|
||||
local_tz = timezone(timedelta(hours=-3))
|
||||
start = datetime.fromisoformat(start_date).replace(hour=0, minute=0, second=0, microsecond=0)
|
||||
if start.tzinfo is None:
|
||||
start = start.replace(tzinfo=timezone.utc)
|
||||
start = start.replace(tzinfo=local_tz)
|
||||
checklist_stats_query = checklist_stats_query.filter(models.Inspection.started_at >= start)
|
||||
if end_date:
|
||||
from datetime import timezone
|
||||
local_tz = timezone(timedelta(hours=-3))
|
||||
end = datetime.fromisoformat(end_date).replace(hour=23, minute=59, second=59, microsecond=999999)
|
||||
if end.tzinfo is None:
|
||||
end = end.replace(tzinfo=timezone.utc)
|
||||
end = end.replace(tzinfo=local_tz)
|
||||
checklist_stats_query = checklist_stats_query.filter(models.Inspection.started_at <= end)
|
||||
if mechanic_id:
|
||||
checklist_stats_query = checklist_stats_query.filter(models.Inspection.mechanic_id == mechanic_id)
|
||||
@@ -1483,15 +1491,17 @@ def get_dashboard_data(
|
||||
|
||||
if start_date:
|
||||
from datetime import timezone
|
||||
local_tz = timezone(timedelta(hours=-3))
|
||||
start = datetime.fromisoformat(start_date).replace(hour=0, minute=0, second=0, microsecond=0)
|
||||
if start.tzinfo is None:
|
||||
start = start.replace(tzinfo=timezone.utc)
|
||||
start = start.replace(tzinfo=local_tz)
|
||||
pass_fail_data = pass_fail_data.filter(models.Inspection.started_at >= start)
|
||||
if end_date:
|
||||
from datetime import timezone
|
||||
local_tz = timezone(timedelta(hours=-3))
|
||||
end = datetime.fromisoformat(end_date).replace(hour=23, minute=59, second=59, microsecond=999999)
|
||||
if end.tzinfo is None:
|
||||
end = end.replace(tzinfo=timezone.utc)
|
||||
end = end.replace(tzinfo=local_tz)
|
||||
pass_fail_data = pass_fail_data.filter(models.Inspection.started_at <= end)
|
||||
if mechanic_id:
|
||||
pass_fail_data = pass_fail_data.filter(models.Inspection.mechanic_id == mechanic_id)
|
||||
@@ -1549,15 +1559,17 @@ def get_inspections_report(
|
||||
# Aplicar filtros
|
||||
if start_date:
|
||||
from datetime import timezone
|
||||
local_tz = timezone(timedelta(hours=-3))
|
||||
start = datetime.fromisoformat(start_date).replace(hour=0, minute=0, second=0, microsecond=0)
|
||||
if start.tzinfo is None:
|
||||
start = start.replace(tzinfo=timezone.utc)
|
||||
start = start.replace(tzinfo=local_tz)
|
||||
query = query.filter(models.Inspection.started_at >= start)
|
||||
if end_date:
|
||||
from datetime import timezone
|
||||
local_tz = timezone(timedelta(hours=-3))
|
||||
end = datetime.fromisoformat(end_date).replace(hour=23, minute=59, second=59, microsecond=999999)
|
||||
if end.tzinfo is None:
|
||||
end = end.replace(tzinfo=timezone.utc)
|
||||
end = end.replace(tzinfo=local_tz)
|
||||
query = query.filter(models.Inspection.started_at <= end)
|
||||
if mechanic_id:
|
||||
query = query.filter(models.Inspection.mechanic_id == mechanic_id)
|
||||
|
||||
@@ -20,7 +20,7 @@ services:
|
||||
retries: 5
|
||||
|
||||
backend:
|
||||
image: dymai/syntria-backend:latest
|
||||
image: dymai/syntria-backend:1.0.9
|
||||
container_name: syntria-backend-prod
|
||||
restart: always
|
||||
depends_on:
|
||||
|
||||
Reference in New Issue
Block a user