mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-08-27 23:17:20 +01:00
Fixes pagination total pages response
If division matched perfectly, an extra page would be added. Fixes #1256
This commit is contained in:
@@ -406,12 +406,15 @@ namespace Tgstation.Server.Host.Controllers
|
||||
foreach (var I in finalResults)
|
||||
resultTransformer(I);
|
||||
|
||||
var carryTheOne = totalResults % pageSize != 0
|
||||
? 1
|
||||
: 0;
|
||||
return Json(
|
||||
new PaginatedResponse<TResultModel>
|
||||
{
|
||||
Content = finalResults,
|
||||
PageSize = pageSize,
|
||||
TotalPages = (ushort)((totalResults / pageSize) + 1)
|
||||
TotalPages = (ushort)(totalResults / pageSize) + carryTheOne
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user