Skip to content

Commit

Permalink
Add verbosity mode to prserved score marking command
Browse files Browse the repository at this point in the history
  • Loading branch information
peppy committed Dec 27, 2023
1 parent 6ee0d9f commit 4462a7c
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ public class MarkNonPreservedScoresCommand
[Option(CommandOptionType.SingleOrNoValue, Template = "--dry-run", Description = "Don't actually mark, just output.")]
public bool DryRun { get; set; }

[Option(CommandOptionType.SingleOrNoValue, Template = "-v|--verbose", Description = "Output when a score is preserved too.")]
public bool Verbose { get; set; }

public async Task<int> OnExecuteAsync(CancellationToken cancellationToken)
{
LegacyDatabaseHelper.RulesetDatabaseInfo databaseInfo = LegacyDatabaseHelper.GetRulesetSpecifics(RulesetId);
Expand Down Expand Up @@ -71,20 +74,23 @@ private async Task processUser(MySqlConnection db, int userId, CancellationToken

if (pins.Contains(score.id))
{
Console.WriteLine($"Maintaining preservation for {score.id} (is pinned)");
if (Verbose)
Console.WriteLine($"Maintaining preservation for {score.id} (is pinned)");
continue;
}

if (checkIsMultiplayerScore(db, score))
{
Console.WriteLine($"Maintaining preservation for {score.id} (is multiplayer)");
if (Verbose)
Console.WriteLine($"Maintaining preservation for {score.id} (is multiplayer)");
continue;
}

// check whether this score is a user high (either total_score or pp)
if (checkIsUserHigh(scores, score))
{
Console.WriteLine($"Maintaining preservation for {score.id} (is user high)");
if (Verbose)
Console.WriteLine($"Maintaining preservation for {score.id} (is user high)");
continue;
}

Expand Down

0 comments on commit 4462a7c

Please sign in to comment.