Skip to content

Commit

Permalink
[24.5] fix split list to include the leftovers (#2006)
Browse files Browse the repository at this point in the history
<!-- Thank you for submitting a Pull Request. If you're new to
contributing to BCApps please read our pull request guideline below
* https://github.com/microsoft/BCApps/Contributing.md
-->
#### Summary <!-- Provide a general summary of your changes -->

port from #2001

#### Work Item(s) <!-- Add the issue number here after the #. The issue
needs to be open and approved. Submitting PRs with no linked issues or
unapproved issues is highly discouraged. -->
Fixes
[AB#548441](https://dynamicssmb2.visualstudio.com/1fcb79e7-ab07-432a-a3c6-6cf5a88ba4a5/_workitems/edit/548441)
  • Loading branch information
haoranpb authored Sep 11, 2024
1 parent 58b8970 commit 3e8cf4f
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ codeunit 1928 "Media Cleanup Impl."
FilterText := FilterText.TrimEnd('|');
end;

// 322, 100 will result in [[1, 100], [101, 200], [201, 300], [301, 322]]
local procedure SplitListIntoSubLists(var InputList: List of [Guid]; SubListCount: Integer; var SplitList: List of [List of [Guid]])
var
Math: Codeunit Math;
Expand All @@ -244,7 +245,7 @@ codeunit 1928 "Media Cleanup Impl."
From: Integer;
ToInt: Integer;
begin
for ListNumber := 0 to Round(InputList.Count() / SubListCount, 1) - 1 do begin
for ListNumber := 0 to Round(InputList.Count() / SubListCount, 1) do begin
Clear(SubList);
From := ListNumber * SubListCount + 1;
ToInt := Math.Min(SubListCount, InputList.Count() - ListNumber * SubListCount);
Expand Down

0 comments on commit 3e8cf4f

Please sign in to comment.