|
|
|
@ -9,7 +9,7 @@ import sys
|
|
|
|
import os
|
|
|
|
import os
|
|
|
|
import httpx
|
|
|
|
import httpx
|
|
|
|
from src.modules.config import get_connection, get_production_connection
|
|
|
|
from src.modules.config import get_connection, get_production_connection
|
|
|
|
from .where_query_sql import get_where_query_sql
|
|
|
|
from .where_query_sql import get_where_query_sql, get_where_query_sql_labour_cost
|
|
|
|
|
|
|
|
|
|
|
|
async def fetch_api_data(
|
|
|
|
async def fetch_api_data(
|
|
|
|
assetnum: str, year: int, RELIABILITY_APP_URL: str, token: str
|
|
|
|
assetnum: str, year: int, RELIABILITY_APP_URL: str, token: str
|
|
|
|
@ -133,7 +133,7 @@ def get_labour_cost_totals(cursor, assetnum: str, worktype: str) -> dict:
|
|
|
|
"""Return yearly labor cost totals for a worktype using the standardized query."""
|
|
|
|
"""Return yearly labor cost totals for a worktype using the standardized query."""
|
|
|
|
if not assetnum or not worktype:
|
|
|
|
if not assetnum or not worktype:
|
|
|
|
return {}
|
|
|
|
return {}
|
|
|
|
where_query = get_where_query_sql(assetnum, worktype)
|
|
|
|
where_query = get_where_query_sql_labour_cost(assetnum, worktype)
|
|
|
|
query = f"""
|
|
|
|
query = f"""
|
|
|
|
SELECT
|
|
|
|
SELECT
|
|
|
|
EXTRACT(YEAR FROM x.reportdate)::int AS tahun,
|
|
|
|
EXTRACT(YEAR FROM x.reportdate)::int AS tahun,
|
|
|
|
|