Skip to content

Commit

Permalink
allow resetting scores
Browse files Browse the repository at this point in the history
  • Loading branch information
francisco-leal committed Feb 23, 2024
1 parent 95a67f1 commit daed264
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
15 changes: 15 additions & 0 deletions commands/reset_scores.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { BaseCommand } from '@adonisjs/core/ace'
import type { CommandOptions } from '@adonisjs/core/types/ace'
import { User } from '#models/user'

export default class ResetScores extends BaseCommand {
static commandName = 'reset:scores'
static description = ''

static options: CommandOptions = {}

async run() {
this.logger.info('Hello world from "ResetScores"')
await User.query().update({ score: 0 })
}
}
4 changes: 2 additions & 2 deletions commands/sync_scores.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export default class SyncScores extends BaseCommand {
score += cast.watches_count
score += cast.quotes_count * 1.5
if (cast.content.includes('$DEGEN')) {
score = score * 1.2
score = score * 1.05
}
return score
}
Expand Down Expand Up @@ -64,7 +64,7 @@ export default class SyncScores extends BaseCommand {
for (let user of users) {
processedUsers += 1
const casts = await Cast.query().where('user_id', user.id).orderBy('id', 'desc').limit(500)
const castScore = this.calculateCastsScore(casts) * 25
const castScore = this.calculateCastsScore(casts) * 10

const connectionScore = this.calculateConnectionScore(user.follower_count)

Expand Down

0 comments on commit daed264

Please sign in to comment.