Compare commits
2 commits
8a138b52d6
...
e1a750cbe3
Author | SHA1 | Date | |
---|---|---|---|
e1a750cbe3 | |||
26514c0961 |
2 changed files with 11 additions and 7 deletions
|
@ -62,12 +62,13 @@ public class Completion{
|
|||
return tries;
|
||||
}
|
||||
|
||||
public void addTry(Puzzle currentPuzzle, byte[] response) {
|
||||
public void addTry(Puzzle currentPuzzle, byte[] response){
|
||||
if (score <= 0){
|
||||
tries++;
|
||||
if (response != null && Arrays.equals(currentPuzzle.getSoluce(), response)) {
|
||||
if (response != null && Arrays.equals(currentPuzzle.getSoluce(), response)){
|
||||
if (tries > 1) { // Loose 5% each try with a minimum of 1 for score
|
||||
score = (int) Math.ceil(currentPuzzle.getScoreMax() * (1 - ((tries - 1) / 20.)));
|
||||
// score = (int) Math.ceil(currentPuzzle.getScoreMax() * (1 - ((tries - 1) / 20.)));
|
||||
score = currentPuzzle.getScoreMax();
|
||||
if (score < 1)
|
||||
score = 1;
|
||||
} else
|
||||
|
|
|
@ -2,9 +2,8 @@ package dev.peerat.backend.routes.admins;
|
|||
|
||||
import java.util.regex.Matcher;
|
||||
|
||||
import org.jose4j.json.internal.json_simple.JSONObject;
|
||||
|
||||
import dev.peerat.backend.bonus.extract.RouteDoc;
|
||||
import dev.peerat.backend.model.Group;
|
||||
import dev.peerat.backend.model.PeerAtUser;
|
||||
import dev.peerat.backend.repository.DatabaseRepository;
|
||||
import dev.peerat.framework.Context;
|
||||
|
@ -29,9 +28,13 @@ public class DynamicLogs implements Response{
|
|||
@RouteDoc(path = "/admin/logs", responseCode = 200, responseDescription = "L'utilisateur peux voir les logs en directe")
|
||||
@RouteDoc(responseCode = 401, responseDescription = "L'utilisateur n'a pas accès à cette ressource")
|
||||
|
||||
@Route(path = "^/admin/logs$", websocket = true)
|
||||
@Route(path = "^/admin/logs$", needLogin = true, websocket = true)
|
||||
public void exec(Matcher matcher, Context context, HttpReader reader, HttpWriter writer) throws Exception {
|
||||
//check if admin
|
||||
Group group = this.repo.getPlayerGroup(context.<PeerAtUser>getUser().getId(), 1);
|
||||
if(!group.getName().equalsIgnoreCase("Quarter-Master - Battles PAC x CEI")){
|
||||
context.response(423);
|
||||
return;
|
||||
}
|
||||
|
||||
Key key = new Key();
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue