Skip to content

Commit

Permalink
Omit zero cursor offset
Browse files Browse the repository at this point in the history
  • Loading branch information
Groxan committed Jun 25, 2024
1 parent 58ca233 commit 5b7a317
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Tzkt.Api/Repositories/OperationRepository.Originations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,9 @@ public async Task<IEnumerable<OriginationOperation>> GetOriginations(
bool includeBigmaps = false)
{
#region opts
if (offset?.Cr == 0 && (sort == null || sort.Asc == "id" || sort.Asc == "level"))
offset.Cr = null;

if (ImplicitSortByLevel)
{
if ((level != null || timestamp != null) && offset?.Cr == null)
Expand Down Expand Up @@ -579,6 +582,9 @@ public async Task<object[][]> GetOriginations(
joins.Add(@"LEFT JOIN ""Accounts"" as c ON c.""Id"" = o.""ContractId""");

#region opts
if (offset?.Cr == 0 && (sort == null || sort.Asc == "id" || sort.Asc == "level"))
offset.Cr = null;

if (ImplicitSortByLevel)
{
if ((level != null || timestamp != null) && offset?.Cr == null)
Expand Down Expand Up @@ -866,6 +872,9 @@ public async Task<object[]> GetOriginations(
joins.Add(@"LEFT JOIN ""Accounts"" as c ON c.""Id"" = o.""ContractId""");

#region opts
if (offset?.Cr == 0 && (sort == null || sort.Asc == "id" || sort.Asc == "level"))
offset.Cr = null;

if (ImplicitSortByLevel)
{
if ((level != null || timestamp != null) && offset?.Cr == null)
Expand Down
9 changes: 9 additions & 0 deletions Tzkt.Api/Repositories/OperationRepository.Transactions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,9 @@ public async Task<IEnumerable<TransactionOperation>> GetTransactions(
bool includeBigmaps = false)
{
#region opts
if (offset?.Cr == 0 && (sort == null || sort.Asc == "id" || sort.Asc == "level"))
offset.Cr = null;

if (ImplicitSortByLevel)
{
if ((level != null || timestamp != null) && offset?.Cr == null)
Expand Down Expand Up @@ -554,6 +557,9 @@ public async Task<object[][]> GetTransactions(
return Array.Empty<object[]>();

#region opts
if (offset?.Cr == 0 && (sort == null || sort.Asc == "id" || sort.Asc == "level"))
offset.Cr = null;

if (ImplicitSortByLevel)
{
if ((level != null || timestamp != null) && offset?.Cr == null)
Expand Down Expand Up @@ -848,6 +854,9 @@ public async Task<object[]> GetTransactions(
return Array.Empty<object>();

#region opts
if (offset?.Cr == 0 && (sort == null || sort.Asc == "id" || sort.Asc == "level"))
offset.Cr = null;

if (ImplicitSortByLevel)
{
if ((level != null || timestamp != null) && offset?.Cr == null)
Expand Down

0 comments on commit 5b7a317

Please sign in to comment.