This commit is contained in:
choelzl 2022-02-09 21:58:48 +01:00
parent ef373eb88e
commit 05062c5dae
Signed by: sora
GPG Key ID: A362EA0491E2EEA0

View File

@ -92,12 +92,12 @@
function addGuess(user,position) { function addGuess(user,position) {
if(seed.round == undefined) return; if(seed.round == undefined) return;
var current_round = ""+seed.round; var current_round = ""+(seed.round-1);
if(guesses[current_round]==undefined) guesses[current_round] = [] if(guesses[current_round]==undefined) guesses[current_round] = []
if(guesses[current_round].some((v)=>v.user==user)) return; if(guesses[current_round].some((v)=>v.user==user)) return;
if(!isCoordinates(position)) return; if(!isCoordinates(position)) return;
var pos = toPos(position) var pos = toPos(position)
var distance = haversineDistance(pos, {lat:seed.rounds[current_round].lat,lng:seed.rounds[current_round].lng}) var distance = haversineDistance(pos, {lat: seed.rounds[current_round].lat, lng: seed.rounds[current_round].lng})
var score = calculateScore(distance, scale) var score = calculateScore(distance, scale)
guesses[current_round].push({ guesses[current_round].push({