From 90b30b0d51d8ea25878d807975f582057b6eba5b Mon Sep 17 00:00:00 2001 From: Jelson Rodrigues Date: Mon, 3 Nov 2025 11:39:10 -0300 Subject: [PATCH] fix: read chats from api when is only one page --- .vscode/launch.json | 20 +++++++++++++++++++- src/main.rs | 2 ++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 6e4125c..133fb6e 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -41,6 +41,24 @@ }, "args": [], "cwd": "${workspaceFolder}" - } + }, +{ + "type": "lldb", + "request": "launch", + "name": "Debug executable 'groupper_report'", + "cargo": { + "args": [ + "build", + "--bin=groupped_repport", + "--package=piperun-bot" + ], + "filter": { + "name": "groupped_repport", + "kind": "bin" + } + }, + "args": ["cargo", "run", "--bin=groupped_repport"], + "cwd": "${workspaceFolder}" + }, ] } \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index 810f33a..ba2e7f3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -459,6 +459,8 @@ fn get_piperun_chats_on_date(PIPERUN_API_URL: &String, client: &reqwest::blockin let current_page = json_response["current_page"].as_i64().expect("Failed to obtain current page number"); let last_page = json_response["last_page"].as_i64().expect("Failed to obtain current page number"); + if current_page == last_page { return aggregated_talks; } + let mut all_other_messages = (current_page..last_page).into_iter() .map(|page| { let page_to_request = page + 1;