Skip to content

Commit

Permalink
Merge pull request #218 from BUTR/code-formatting/fix-codeformatting
Browse files Browse the repository at this point in the history
Automated PR to fix formatting errors
  • Loading branch information
Aragas authored Jun 27, 2024
2 parents d9011ab + 789cf4f commit 20ff11e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions src/BUTR.Site.NexusMods.Server/Extensions/QueryableExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public static async Task<Paging<TEntity>> PaginatedAsync<TEntity>(this IQueryabl
where TEntity : class
{
var startTime = Stopwatch.GetTimestamp();

var count = await queryable.CountAsync(ct);

return new()
Expand All @@ -90,7 +90,7 @@ public static async Task<Paging<TEntity>> PaginatedAsync<TEntity>(this IQueryabl
}
};
}

public static Task<Paging<TEntity>> PaginatedGroupedAsync<TEntity>(this IQueryable<TEntity> queryable, PaginatedQuery query, uint maxPageSize = 20, Sorting? defaultSorting = default, CancellationToken ct = default)
where TEntity : class
{
Expand All @@ -106,20 +106,20 @@ public static Task<Paging<TEntity>> PaginatedGroupedAsync<TEntity>(this IQueryab
.WithSort(sortings)
.PaginatedGroupedAsync(page, pageSize, ct);
}

public static async Task<Paging<TEntity>> PaginatedGroupedAsync<TEntity>(this IQueryable<TEntity> queryable, uint page, uint pageSize, CancellationToken ct = default)
where TEntity : class
{
var startTime = Stopwatch.GetTimestamp();

var response = await queryable.GroupBy(_ => 1)
.Select(x => new
.Select(x => new
{
PageItems = x.Skip((int) ((page - 1) * pageSize)).Take((int) pageSize).ToList(),
Total = x.Count()
})
.FirstAsync(cancellationToken: ct);

return new()
{
StartTime = startTime,
Expand Down
2 changes: 1 addition & 1 deletion src/BUTR.Site.NexusMods.Server/Repositories/IRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public Task<Paging<TEntity>> PaginatedAsync(PaginatedQuery query, uint maxPageSi
public Task<Paging<TProjection>> PaginatedAsync<TProjection>(Expression<Func<TEntity, TProjection>> projection, PaginatedQuery query, uint maxPageSize = 20, Sorting? defaultSorting = default, CancellationToken ct = default)
where TProjection : class => InternalQuery
.Select(projection)
//.PaginatedGroupedAsync(query, maxPageSize, defaultSorting, ct);
//.PaginatedGroupedAsync(query, maxPageSize, defaultSorting, ct);
.PaginatedAsync(query, maxPageSize, defaultSorting, ct);


Expand Down

0 comments on commit 20ff11e

Please sign in to comment.