Fixes pagination total pages response

If division matched perfectly, an extra page would be added.

Fixes #1256
This commit is contained in:
Jordan Brown
2021-05-09 10:34:39 -04:00
parent 1e9e97f0cb
commit e75df2877d
@@ -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
});
}
}