1
0
Fork 0

Add maximum to actor follow scores

This commit is contained in:
Chocobozzz 2018-01-11 18:35:39 +01:00
parent 4bbc373f13
commit 05bc4dfa06
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
1 changed files with 1 additions and 1 deletions

View File

@ -307,7 +307,7 @@ export class ActorFollowModel extends Model<ActorFollowModel> {
private static incrementScores (inboxUrls: string[], value: number, t: Sequelize.Transaction) {
const inboxUrlsString = inboxUrls.map(url => `'${url}'`).join(',')
const query = 'UPDATE "actorFollow" SET "score" = "score" +' + value + ' ' +
const query = `UPDATE "actorFollow" SET "score" = LEAST("score" + ${value}, ${ACTOR_FOLLOW_SCORE.MAX}) ` +
'WHERE id IN (' +
'SELECT "actorFollow"."id" FROM "actorFollow" ' +
'INNER JOIN "actor" ON "actor"."id" = "actorFollow"."actorId" ' +