| 14 | constructor(readonly userDataFactory: UserDataFactory) {} |
| 15 | |
| 16 | command() { |
| 17 | return new Command("check-stats") |
| 18 | .description("Check and fix user stats.") |
| 19 | .addOption( |
| 20 | new Option( |
| 21 | "--min-speed <speed>", |
| 22 | "Minimal allowed result speed, inclusive.", |
| 23 | ).argParser(parseSpeed), |
| 24 | ) |
| 25 | .addOption( |
| 26 | new Option( |
| 27 | "--max-speed <speed>", |
| 28 | "Maximal allowed result speed, inclusive.", |
| 29 | ).argParser(parseSpeed), |
| 30 | ) |
| 31 | .addOption( |
| 32 | new Option( |
| 33 | "--since <timestamp>", |
| 34 | "Check only files modified since the given timestamp.", |
| 35 | ).argParser(parseTimestamp), |
| 36 | ) |
| 37 | .addOption(new Option("--fix", "Fix damaged user stats.")) |
| 38 | .addOption(new Option("--verbose", "Show more diagnostic messages.")) |
| 39 | .addArgument( |
| 40 | new Argument( |
| 41 | "<user-id-range>", |
| 42 | "Range of the user ids to check.", |
| 43 | ).argParser(parseUserIdRange), |
| 44 | ) |
| 45 | .action(this.action.bind(this)); |
| 46 | } |
| 47 | |
| 48 | async action( |
| 49 | range: UserIdRange, |