From 489d090267a05dedf914d4c464d9f0fd5d4e7b1e Mon Sep 17 00:00:00 2001 From: Rafael Date: Tue, 28 May 2024 14:03:50 -0300 Subject: [PATCH] =?UTF-8?q?ajusta=20regra=20de=20datas=20n=C3=A3o=20pagas?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pipelines/rj_smtr/controle_financeiro/tasks.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/pipelines/rj_smtr/controle_financeiro/tasks.py b/pipelines/rj_smtr/controle_financeiro/tasks.py index 2fed7b0bd..e18258bd4 100644 --- a/pipelines/rj_smtr/controle_financeiro/tasks.py +++ b/pipelines/rj_smtr/controle_financeiro/tasks.py @@ -145,7 +145,18 @@ def cct_arquivo_retorno_save_redis(redis_key: str, raw_filepath: str): df["dataOrdem"] = pd.to_datetime(df["dataOrdem"]).dt.strftime("%Y-%m-%d") all_returned_dates = df["dataOrdem"].unique().tolist() pending_dates = ( - df.loc[~df["isPago"]]["dataOrdem"].unique().tolist() # pylint: disable=E1101 + df.groupby( # pylint: disable=E1101 + [ + "idConsorcio", + "idOperadora", + "dataOrdem", + ] + )["isPago"] + .max() + .reset_index() + .loc[~df["isPago"]]["dataOrdem"] + .unique() + .tolist() ) log(f"The API returned the following dates: {sorted(all_returned_dates)}") @@ -169,7 +180,7 @@ def cct_arquivo_retorno_save_redis(redis_key: str, raw_filepath: str): f""" Saving values on redis last_date: {redis_return["last_date"]} - pending_dates: {redis_return["pending_dates"]} + pending_dates: {sorted(redis_return["pending_dates"])} """ )