Simplify auto report score handling
parent
0dc22f1b2f
commit
ef5b89fe87
|
@ -66,15 +66,14 @@ final class IrwinApi(
|
|||
lila.mon.mod.irwin.mark.increment().unit
|
||||
else if (report.activation >= thresholds.get().report) for {
|
||||
suspect <- getSuspect(report.suspectId.value)
|
||||
irwin <- userRepo byId "irwin" orFail s"Irwin user not found" dmap Mod.apply
|
||||
irwin <- userRepo.irwin orFail s"Irwin user not found" dmap Mod.apply
|
||||
_ <- reportApi.create(
|
||||
Report.Candidate(
|
||||
reporter = Reporter(irwin.user),
|
||||
suspect = suspect,
|
||||
reason = lila.report.Reason.Cheat,
|
||||
text = s"${report.activation}% over ${report.games.size} games"
|
||||
),
|
||||
(_: Report.Score) => Report.Score(60)
|
||||
)
|
||||
)
|
||||
} yield lila.mon.mod.irwin.report.increment().unit
|
||||
else funit
|
||||
|
|
|
@ -134,6 +134,7 @@ object Report {
|
|||
def isAutomatic = reporter.id == ReporterId.lichess
|
||||
def isAutoComm = isAutomatic && isComm
|
||||
def isAutoBoost = isAutomatic && isBoost
|
||||
def isIrwinCheat = reporter.id == ReporterId.irwin && isCheat
|
||||
def isCoachReview = isOther && text.contains("COACH REVIEW")
|
||||
}
|
||||
|
||||
|
|
|
@ -51,9 +51,9 @@ final class ReportApi(
|
|||
}
|
||||
}
|
||||
|
||||
def create(c: Candidate, score: Report.Score => Report.Score = identity): Funit =
|
||||
def create(c: Candidate): Funit =
|
||||
(!c.reporter.user.marks.reportban && !isAlreadySlain(c)) ?? {
|
||||
scorer(c) map (_ withScore score) flatMap { case scored @ Candidate.Scored(candidate, _) =>
|
||||
scorer(c) flatMap { case scored @ Candidate.Scored(candidate, _) =>
|
||||
coll
|
||||
.one[Report](
|
||||
$doc(
|
||||
|
@ -324,8 +324,7 @@ final class ReportApi(
|
|||
suspect = suspect,
|
||||
reason = Reason.Comm,
|
||||
text = text
|
||||
),
|
||||
_ atLeast 40
|
||||
)
|
||||
)
|
||||
case _ => funit
|
||||
}
|
||||
|
|
|
@ -11,8 +11,7 @@ final private class ReportScore(
|
|||
impl.reporterScore(candidate.reporter) +
|
||||
impl.autoScore(candidate)
|
||||
} map
|
||||
impl.fixedAutoCommPrintScore(candidate) map
|
||||
impl.fixedBoostScore(candidate) map { score =>
|
||||
impl.fixedAutoScore(candidate) map { score =>
|
||||
candidate scored Report.Score(score atLeast 5 atMost 100)
|
||||
}
|
||||
|
||||
|
@ -29,15 +28,12 @@ final private class ReportScore(
|
|||
|
||||
def autoScore(candidate: Report.Candidate) = candidate.isAutomatic ?? 25d
|
||||
|
||||
// https://github.com/ornicar/lila/issues/4093
|
||||
// https://github.com/ornicar/lila/issues/4587
|
||||
def fixedAutoCommPrintScore(c: Report.Candidate)(score: Double): Double =
|
||||
if (c.isAutoComm) baseScore
|
||||
else if (c.isPrint || c.isCoachReview || c.isPlaybans) baseScore * 2
|
||||
else score
|
||||
|
||||
def fixedBoostScore(c: Report.Candidate)(score: Double): Double =
|
||||
def fixedAutoScore(c: Report.Candidate)(score: Double): Double =
|
||||
if (c.isAutoBoost) baseScore * 1.5
|
||||
else if (c.isAutoComm) 40d
|
||||
else if (c.isIrwinCheat) 60d
|
||||
else if (c.isPrint || c.isCoachReview || c.isPlaybans) baseScore * 2
|
||||
else score
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue