Persist beatmap file to database in fix old scores, min discord cutoff after fix
This commit is contained in:
parent
df35787be2
commit
bafe15f6ea
@ -118,6 +118,11 @@ class FixOldScores(
|
||||
if(beatmapFile == null) {
|
||||
this.logger.error("Failed to fetch beatmap file for beatmap_id = ${score.beatmapId} from osu!api")
|
||||
return
|
||||
} else {
|
||||
dslContext.update(BEATMAPS)
|
||||
.set(BEATMAPS.BEATMAP_FILE, beatmapFile)
|
||||
.where(BEATMAPS.BEATMAP_ID.eq(score.beatmapId))
|
||||
.execute()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -18,6 +18,7 @@ import org.springframework.context.annotation.Profile
|
||||
import org.springframework.scheduling.annotation.Scheduled
|
||||
import org.springframework.stereotype.Service
|
||||
import java.time.LocalDateTime
|
||||
import java.time.OffsetDateTime
|
||||
import kotlin.math.roundToInt
|
||||
|
||||
@Profile("discord")
|
||||
@ -33,11 +34,17 @@ class SendScoresToDiscord(
|
||||
|
||||
private val logger = LoggerFactory.getLogger(javaClass)
|
||||
|
||||
// 2024-03-03 00:00:00
|
||||
private val minCutoff = OffsetDateTime.of(
|
||||
2024, 3, 3, 0, 0, 0, 0, OffsetDateTime.now().offset
|
||||
)
|
||||
|
||||
@Scheduled(fixedDelay = 1200000, initialDelay = 0)
|
||||
fun sendScoresToDiscord() {
|
||||
dslContext.selectFrom(SCORES)
|
||||
.where(SCORES.SENT_DISCORD_NOTIFICATION.isFalse)
|
||||
.or(SCORES.SENT_DISCORD_NOTIFICATION.isNull)
|
||||
.and(SCORES.ADDED_AT.greaterOrEqual(minCutoff))
|
||||
.and(SCORES.ADJUSTED_UR.isNotNull)
|
||||
.and(SCORES.ADJUSTED_UR.lessOrEqual(25.0))
|
||||
.and(SCORES.IS_BANNED.isFalse)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user