mirror of
https://github.com/signalapp/Signal-Server
synced 2026-04-20 05:38:04 +01:00
Integer comparison of captcha scores
This commit is contained in:
@@ -76,7 +76,13 @@ public class AssessmentResult {
|
||||
if (!solved) {
|
||||
return false;
|
||||
}
|
||||
return this.actualScore >= scoreThreshold.orElse(this.defaultScoreThreshold);
|
||||
// Since HCaptcha scores are truncated to 2 decimal places, we can multiply by 100 and round to the nearest int for
|
||||
// comparison instead of floating point comparisons
|
||||
return normalizedIntScore(this.actualScore) >= normalizedIntScore(scoreThreshold.orElse(this.defaultScoreThreshold));
|
||||
}
|
||||
|
||||
private static int normalizedIntScore(final float score) {
|
||||
return Math.round(score * 100);
|
||||
}
|
||||
|
||||
public String getScoreString() {
|
||||
|
||||
Reference in New Issue
Block a user