Move nbGamesToMark to config
This commit is contained in:
parent
424f740d72
commit
34ae511a93
|
@ -9,7 +9,7 @@ import reactivemongo.bson._
|
|||
import scala.concurrent._
|
||||
|
||||
|
||||
final class BoostingApi(modApi: ModApi, collBoosting: Coll) {
|
||||
final class BoostingApi(modApi: ModApi, collBoosting: Coll, nbGamesToMark: Int) {
|
||||
import BoostingApi._
|
||||
|
||||
private implicit val boostingRecordBSONHandler = Macros.handler[BoostingRecord]
|
||||
|
@ -22,7 +22,7 @@ final class BoostingApi(modApi: ModApi, collBoosting: Coll) {
|
|||
collBoosting.update(BSONDocument("_id" -> record.id), record, upsert = true).void
|
||||
|
||||
def determineBoosting(record: BoostingRecord, winner: User): Funit = {
|
||||
if (record.games >= 3) {
|
||||
if (record.games >= nbGamesToMark) {
|
||||
modApi.autoBooster(winner.username)
|
||||
} else {
|
||||
funit
|
||||
|
|
|
@ -18,6 +18,7 @@ final class Env(
|
|||
private val CollectionBoosting = config getString "collection.boosting"
|
||||
private val CollectionModlog = config getString "collection.modlog"
|
||||
private val ActorName = config getString "actor.name"
|
||||
private val NbGamesToMark = config getInt "nb_games_to_mark"
|
||||
|
||||
private[mod] lazy val modlogColl = db(CollectionModlog)
|
||||
|
||||
|
@ -33,7 +34,8 @@ final class Env(
|
|||
|
||||
private lazy val boosting = new BoostingApi(
|
||||
modApi = api,
|
||||
collBoosting = db(CollectionBoosting))
|
||||
collBoosting = db(CollectionBoosting),
|
||||
nbGamesToMark = NbGamesToMark)
|
||||
|
||||
// api actor
|
||||
private val actorApi = system.actorOf(Props(new Actor {
|
||||
|
|
Loading…
Reference in a new issue