Skip to content

Commit

Permalink
fix: #dev filter for gamerecord empty
Browse files Browse the repository at this point in the history
  • Loading branch information
marcinbator committed Nov 28, 2024
1 parent 5ef4ed9 commit 3c3dd65
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions rag-2-backend/Infrastructure/Dao/GameRecordDao.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class GameRecordDao(DatabaseContext dbContext)
public virtual async Task<List<GameRecordResponse>> GetRecordsByGameAndUser(
int gameId,
int userId,
bool? isEmptyRecord,
bool? includeEmptyRecords,
DateTime? endDateFrom,
DateTime? endDateTo,
SortDirection sortDirection,
Expand All @@ -33,7 +33,7 @@ GameRecordSortByFields sortBy
.Where(r => r.Game.Id == gameId && r.User.Id == userId)
.AsQueryable();

query = FilterGameRecords(isEmptyRecord, endDateFrom, endDateTo, query);
query = FilterGameRecords(includeEmptyRecords, endDateFrom, endDateTo, query);
query = SortGameRecords(sortDirection, sortBy, query);

return await Task.Run(() => query.AsEnumerable()
Expand Down Expand Up @@ -111,14 +111,14 @@ public virtual void PerformGameRecordTransaction(Game game, GameRecord gameRecor
//

private static IQueryable<GameRecord> FilterGameRecords(
bool? isEmptyRecord,
bool? includeEmptyRecords,
DateTime? endDateFrom,
DateTime? endDateTo,
IQueryable<GameRecord> query
)
{
if (isEmptyRecord.HasValue)
query = query.Where(u => u.IsEmptyRecord == isEmptyRecord);
if (includeEmptyRecords is null or false)
query = query.Where(u => u.IsEmptyRecord == false);
if (endDateFrom.HasValue)
query = query.Where(u => u.Ended >= endDateFrom);
if (endDateTo.HasValue)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class GameRecordController(GameRecordService gameRecordService) : Control
public async Task<List<GameRecordResponse>> GetRecordsByGame(
[Required] int gameId,
[Required] int userId,
bool? isEmptyRecord,
bool? includeEmptyRecords,
DateTime? endDateFrom,
DateTime? endDateTo,
SortDirection sortDirection = SortDirection.Asc,
Expand All @@ -34,7 +34,7 @@ public async Task<List<GameRecordResponse>> GetRecordsByGame(
return await gameRecordService.GetRecordsByGameAndUser(
gameId,
userId,
isEmptyRecord,
includeEmptyRecords,
endDateFrom,
endDateTo,
sortDirection,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ GameDao gameDao
public async Task<List<GameRecordResponse>> GetRecordsByGameAndUser(
int gameId,
int userId,
bool? isEmptyRecord,
bool? includeEmptyRecords,
DateTime? endDateFrom,
DateTime? endDateTo,
SortDirection sortDirection,
Expand All @@ -42,7 +42,7 @@ string email
return await gameRecordDao.GetRecordsByGameAndUser(
gameId,
userId,
isEmptyRecord,
includeEmptyRecords,
endDateFrom,
endDateTo,
sortDirection,
Expand Down
2 changes: 1 addition & 1 deletion rag-2-backend/Infrastructure/Util/HashUtil.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace rag_2_backend.Infrastructure.Util;

public abstract class HashUtil
public static class HashUtil
{
public static string HashPassword(string password)
{
Expand Down

0 comments on commit 3c3dd65

Please sign in to comment.