Skip to content

Commit

Permalink
Remove ConditionService logging.
Browse files Browse the repository at this point in the history
  • Loading branch information
marchermans committed Nov 11, 2024
1 parent 7ae8482 commit 20b1eed
Showing 1 changed file with 0 additions and 15 deletions.
15 changes: 0 additions & 15 deletions LDTTeam.Authentication.Server/Services/ConditionService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ public class ConditionService(DatabaseContext db, IServiceProvider services, ILo
{
public async Task<bool?> CheckReward(string provider, string providerKey, string rewardId, CancellationToken cancellationToken)
{
logger.LogInformation("Checking reward {RewardId} for {Provider} {ProviderKey}", rewardId, provider, providerKey);

if (!provider.Equals("minecraft", StringComparison.CurrentCultureIgnoreCase))
return false;

Expand Down Expand Up @@ -58,15 +56,12 @@ public class ConditionService(DatabaseContext db, IServiceProvider services, ILo

private async Task<bool> CheckReward(string userId, Reward reward, CancellationToken cancellationToken)
{
logger.LogInformation("Checking reward {RewardId} for {UserId}", reward.Id, userId);

try
{
using IServiceScope scope = services.CreateScope();

foreach (ConditionInstance conditionInstance in reward.Conditions)
{
logger.LogDebug("Checking condition {ConditionName} for {UserId}", conditionInstance.ConditionName, userId);
ICondition? condition = Conditions.Registry.FirstOrDefault(x =>
x.ModuleName.Equals(conditionInstance.ModuleName,
StringComparison.InvariantCultureIgnoreCase) &&
Expand All @@ -92,8 +87,6 @@ private async Task<bool> CheckReward(string userId, Reward reward, CancellationT

public async Task<Dictionary<string, bool>?> GetRewardsForUser(string provider, string providerKey, CancellationToken token)
{
logger.LogInformation("Getting rewards for {Provider} {ProviderKey}", provider, providerKey);

IdentityUserLogin<string>? loginInfo = await db.UserLogins.FirstOrDefaultAsync(x =>
x.LoginProvider.ToLower() == provider.ToLower() &&
x.ProviderKey.ToLower() == providerKey.ToLower(),
Expand Down Expand Up @@ -121,8 +114,6 @@ private async Task<bool> CheckReward(string userId, Reward reward, CancellationT

public async Task<Dictionary<string, bool>> GetRewardsForUser(string userId, CancellationToken token)
{
logger.LogInformation("Getting rewards for {UserId}", userId);

Dictionary<string, bool> results = new();
await foreach (Reward dbReward in db.Rewards.Include(x => x.Conditions).AsAsyncEnumerable().WithCancellation(token))
{
Expand All @@ -134,8 +125,6 @@ public async Task<Dictionary<string, bool>> GetRewardsForUser(string userId, Can

public async Task<Dictionary<string, List<string>>> GetRewardsForProvider(string provider, CancellationToken token)
{
logger.LogInformation("Getting rewards for {Provider}", provider);

List<IdentityUserLogin<string>>? logins = await db.UserLogins.Where(x =>
x.LoginProvider.ToLower() == provider.ToLower())
.ToListAsync(cancellationToken: token);
Expand All @@ -159,8 +148,6 @@ public async Task<Dictionary<string, List<string>>> GetRewardsForProvider(string

public async Task AddConditionToReward(string rewardId, string moduleName, string conditionName, string lambda, CancellationToken token)
{
logger.LogInformation("Adding condition {ConditionName} to {RewardId}", conditionName, rewardId);

ICondition? condition = Conditions.Registry.FirstOrDefault(x =>
x.ModuleName.Equals(moduleName,
StringComparison.InvariantCultureIgnoreCase) &&
Expand Down Expand Up @@ -194,8 +181,6 @@ public async Task AddConditionToReward(string rewardId, string moduleName, strin

public async Task RemoveConditionFromReward(string rewardId, string moduleName, string conditionName, CancellationToken token)
{
logger.LogInformation("Removing condition {ConditionName} from {RewardId}", conditionName, rewardId);

ConditionInstance? instance = await db.ConditionInstances.FirstOrDefaultAsync(x =>
x.RewardId.ToLower() == rewardId.ToLower() &&
x.ModuleName.ToLower() == moduleName.ToLower() &&
Expand Down

0 comments on commit 20b1eed

Please sign in to comment.