Skip to content

Commit

Permalink
ajusta regra de datas não pagas
Browse files Browse the repository at this point in the history
  • Loading branch information
pixuimpou committed May 28, 2024
1 parent a9e803b commit 489d090
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions pipelines/rj_smtr/controle_financeiro/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)}")
Expand All @@ -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"])}
"""
)

Expand Down

0 comments on commit 489d090

Please sign in to comment.