From 5b7a317333097051b43212c8a54c7ed739b5ea13 Mon Sep 17 00:00:00 2001 From: 257Byte <257byte@gmail.com> Date: Tue, 25 Jun 2024 21:11:36 +0300 Subject: [PATCH] Omit zero cursor offset --- .../Repositories/OperationRepository.Originations.cs | 9 +++++++++ .../Repositories/OperationRepository.Transactions.cs | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/Tzkt.Api/Repositories/OperationRepository.Originations.cs b/Tzkt.Api/Repositories/OperationRepository.Originations.cs index 0d6aa840..61e3144a 100644 --- a/Tzkt.Api/Repositories/OperationRepository.Originations.cs +++ b/Tzkt.Api/Repositories/OperationRepository.Originations.cs @@ -379,6 +379,9 @@ public async Task> 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) @@ -579,6 +582,9 @@ public async Task 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) @@ -866,6 +872,9 @@ public async Task 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) diff --git a/Tzkt.Api/Repositories/OperationRepository.Transactions.cs b/Tzkt.Api/Repositories/OperationRepository.Transactions.cs index 1b0c3be6..237ace40 100644 --- a/Tzkt.Api/Repositories/OperationRepository.Transactions.cs +++ b/Tzkt.Api/Repositories/OperationRepository.Transactions.cs @@ -349,6 +349,9 @@ public async Task> 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) @@ -554,6 +557,9 @@ public async Task GetTransactions( return Array.Empty(); #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) @@ -848,6 +854,9 @@ public async Task GetTransactions( return Array.Empty(); #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)