fix: read chats from api when is only one page

This commit is contained in:
2025-11-03 11:39:10 -03:00
parent 5bb0ad8b1a
commit 90b30b0d51
2 changed files with 21 additions and 1 deletions

20
.vscode/launch.json vendored
View File

@@ -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}"
},
]
}

View File

@@ -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;