fix rating range for non-pool "new opponent" games
parent
7b21384341
commit
67249c1f76
|
@ -194,7 +194,7 @@ final class Setup(
|
|||
_ ?? { game =>
|
||||
for {
|
||||
blocking <- ctx.userId ?? env.relation.api.fetchBlocking
|
||||
hookConfig = lila.setup.HookConfig.default updateFrom game
|
||||
hookConfig = lila.setup.HookConfig.default withRatingRange get("rr") updateFrom game
|
||||
sameOpponents = game.userIds
|
||||
hookResult <-
|
||||
processor
|
||||
|
|
|
@ -37,7 +37,8 @@ object RatingRange {
|
|||
if min < max
|
||||
} yield RatingRange(min, max)
|
||||
|
||||
def orDefault(from: String) = apply(from) | default
|
||||
def orDefault(from: String) = apply(from) | default
|
||||
def orDefault(from: Option[String]) = from.flatMap(apply) | default
|
||||
|
||||
def noneIfDefault(from: String) =
|
||||
if (from == default.toString) none
|
||||
|
|
|
@ -102,6 +102,8 @@ case class HookConfig(
|
|||
days = game.daysPerTurn | days,
|
||||
mode = game.mode
|
||||
)
|
||||
|
||||
def withRatingRange(str: Option[String]) = copy(ratingRange = RatingRange orDefault str)
|
||||
}
|
||||
|
||||
object HookConfig extends BaseHumanConfig {
|
||||
|
|
|
@ -32,7 +32,7 @@ module.exports = function(cfg, element) {
|
|||
onFirstConnect = function() {
|
||||
var gameId = getParameterByName('hook_like');
|
||||
if (!gameId) return;
|
||||
$.post('/setup/hook/' + lichess.sri + '/like/' + gameId);
|
||||
$.post(`/setup/hook/${lichess.sri}/like/${gameId}?rr=${lobby.setup.ratingRange() || ''}`);
|
||||
lobby.setTab('real_time');
|
||||
history.replaceState(null, null, '/');
|
||||
},
|
||||
|
|
|
@ -11,6 +11,8 @@ export default class Setup {
|
|||
ai: FormStore;
|
||||
}
|
||||
|
||||
ratingRange = () => this.stores.hook.get()?.ratingRange;
|
||||
|
||||
constructor(makeStorage: (name: string) => LichessStorage, readonly root: LobbyController) {
|
||||
this.stores = {
|
||||
hook: makeStore(makeStorage('lobby.setup.hook')),
|
||||
|
|
Loading…
Reference in New Issue