remove Boolean.?

This commit is contained in:
Thibault Duplessis 2018-07-20 12:25:23 +02:00
parent d8288daa11
commit e6bbade0b1
3 changed files with 24 additions and 25 deletions

View file

@ -13,8 +13,6 @@ final class PimpedBoolean(private val self: Boolean) extends AnyVal {
*/
def ??[A](a: => A)(implicit z: Zero[A]): A = if (self) a else z.zero
def ?[X](t: => X) = new { def |(f: => X) = if (self) t else f }
def option[A](a: => A): Option[A] = if (self) Some(a) else None
def optionFu[A](v: => Fu[A])(implicit ec: ExecutionContext): Fu[Option[A]] =

View file

@ -76,19 +76,19 @@ final class ModlogApi(coll: Coll) {
}
def toggleCloseTopic(mod: String, categ: String, topic: String, closed: Boolean) = add {
Modlog(mod, none, closed ? Modlog.closeTopic | Modlog.openTopic, details = Some(
Modlog(mod, none, if (closed) Modlog.closeTopic else Modlog.openTopic, details = Some(
categ + " / " + topic
))
}
def toggleHideTopic(mod: String, categ: String, topic: String, hidden: Boolean) = add {
Modlog(mod, none, hidden ? Modlog.hideTopic | Modlog.showTopic, details = Some(
Modlog(mod, none, if (hidden) Modlog.hideTopic else Modlog.showTopic, details = Some(
categ + " / " + topic
))
}
def toggleStickyTopic(mod: String, categ: String, topic: String, sticky: Boolean) = add {
Modlog(mod, none, sticky ? Modlog.stickyTopic | Modlog.unstickyTopic, details = Some(
Modlog(mod, none, if (sticky) Modlog.stickyTopic else Modlog.unstickyTopic, details = Some(
categ + " / " + topic
))
}

View file

@ -261,27 +261,28 @@ Thank you all, you rock!"""
at(today, 7) map { date => Schedule(Eastern, Rapid, Standard, std, date |> orTomorrow).plan }
).flatten,
(isHalloween ? // replace more thematic tournaments on halloween
(if (isHalloween) // replace more thematic tournaments on halloween
List(
1 -> StartingPosition.presets.halloween,
5 -> StartingPosition.presets.frankenstein,
9 -> StartingPosition.presets.halloween,
13 -> StartingPosition.presets.frankenstein,
17 -> StartingPosition.presets.halloween,
21 -> StartingPosition.presets.frankenstein
) |
List( // random opening replaces hourly 3 times a day
3 -> opening(offset = 2),
11 -> opening(offset = 1),
19 -> opening(offset = 0)
)).flatMap {
case (hour, opening) => List(
at(today, hour) map { date => Schedule(Hourly, Bullet, Standard, opening, date |> orTomorrow).plan },
at(today, hour + 1) map { date => Schedule(Hourly, SuperBlitz, Standard, opening, date |> orTomorrow).plan },
at(today, hour + 2) map { date => Schedule(Hourly, Blitz, Standard, opening, date |> orTomorrow).plan },
at(today, hour + 3) map { date => Schedule(Hourly, Rapid, Standard, opening, date |> orTomorrow).plan }
).flatten
},
1 -> StartingPosition.presets.halloween,
5 -> StartingPosition.presets.frankenstein,
9 -> StartingPosition.presets.halloween,
13 -> StartingPosition.presets.frankenstein,
17 -> StartingPosition.presets.halloween,
21 -> StartingPosition.presets.frankenstein
)
else
List( // random opening replaces hourly 3 times a day
3 -> opening(offset = 2),
11 -> opening(offset = 1),
19 -> opening(offset = 0)
)).flatMap {
case (hour, opening) => List(
at(today, hour) map { date => Schedule(Hourly, Bullet, Standard, opening, date |> orTomorrow).plan },
at(today, hour + 1) map { date => Schedule(Hourly, SuperBlitz, Standard, opening, date |> orTomorrow).plan },
at(today, hour + 2) map { date => Schedule(Hourly, Blitz, Standard, opening, date |> orTomorrow).plan },
at(today, hour + 3) map { date => Schedule(Hourly, Rapid, Standard, opening, date |> orTomorrow).plan }
).flatten
},
// hourly standard tournaments!
(0 to 6).toList.flatMap { hourDelta =>