Skip to content

Commit

Permalink
chore: add additional multiplier for positions open prior to points s…
Browse files Browse the repository at this point in the history
…tart
  • Loading branch information
halaprix committed May 28, 2024
1 parent 39f7370 commit 85fc518
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions background-jobs/update-rays-cron-function/src/point-accrual.ts
Original file line number Diff line number Diff line change
Expand Up @@ -467,16 +467,27 @@ export class SummerPointsService {
const firstEvent = position.firstEvent[0].timestamp
const lastEvent = endTimestamp
const startTime = Math.max(firstEvent, START_POINTS_TIMESTAMP)

const howLongWasPositionOpenBeforePointsStart = startTime - firstEvent
let additionalMultiplier = 1
if (howLongWasPositionOpenBeforePointsStart > 180 * this.SECONDS_PER_DAY) {
additionalMultiplier = 1.3
} else if (howLongWasPositionOpenBeforePointsStart > 90 * this.SECONDS_PER_DAY) {
additionalMultiplier = 1.15
} else if (howLongWasPositionOpenBeforePointsStart > 30 * this.SECONDS_PER_DAY) {
additionalMultiplier = 1.05
}

const timeOpen = lastEvent - startTime

if (timeOpen > 180 * this.SECONDS_PER_DAY) {
return 2
return 2 * additionalMultiplier
} else if (timeOpen > 90 * this.SECONDS_PER_DAY) {
return 1.5
return 1.5 * additionalMultiplier
} else if (timeOpen > 30 * this.SECONDS_PER_DAY) {
return 1.2
return 1.2 * additionalMultiplier
} else {
return 1
return 1 * additionalMultiplier
}
}

Expand Down

0 comments on commit 85fc518

Please sign in to comment.