From c5a5421f2304e760b094ad93a97c12b1d1ea5eba Mon Sep 17 00:00:00 2001 From: TheDude Date: Fri, 16 Aug 2024 13:14:36 +0100 Subject: [PATCH] Ordered the returned projects by block index and returned top to bottom --- src/Blockcore.Indexer.Angor/Storage/Mongo/AngorMongoData.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Blockcore.Indexer.Angor/Storage/Mongo/AngorMongoData.cs b/src/Blockcore.Indexer.Angor/Storage/Mongo/AngorMongoData.cs index 6d0689f..2aa71dd 100644 --- a/src/Blockcore.Indexer.Angor/Storage/Mongo/AngorMongoData.cs +++ b/src/Blockcore.Indexer.Angor/Storage/Mongo/AngorMongoData.cs @@ -4,7 +4,6 @@ using Blockcore.Indexer.Core.Crypto; using Blockcore.Indexer.Core.Operations.Types; using Blockcore.Indexer.Core.Settings; -using Blockcore.Indexer.Core.Storage; using Blockcore.Indexer.Core.Storage.Mongo; using Blockcore.Indexer.Core.Storage.Mongo.Types; using Blockcore.Indexer.Core.Storage.Types; @@ -227,6 +226,7 @@ public async Task> GetProjectsAsync(int? offset, int itemsToSkip = offset ?? ((int)total < limit ? 0 : (int)total - limit); var projects = mongoDb.ProjectTable.AsQueryable() + .OrderBy(x => x.BlockIndex) .Skip(itemsToSkip) .Take(limit) .ToList(); @@ -240,7 +240,7 @@ public async Task> GetProjectsAsync(int? offset, ProjectIdentifier = _.AngorKey, TrxId = _.TransactionId, CreatedOnBlock = _.BlockIndex - }), + }).OrderByDescending(x => x.CreatedOnBlock), Offset = itemsToSkip, Limit = limit, Total = total @@ -254,6 +254,7 @@ public async Task> GetProjectInvestmentsAsync(str int itemsToSkip = offset ?? ((int)total < limit ? 0 : (int)total - limit); var investments = mongoDb.InvestmentTable.AsQueryable() + .OrderBy(x => x.BlockIndex) .Where(_ => _.AngorKey == projectId) .Skip(itemsToSkip) .Take(limit)