eintragung geht 🎉
All checks were successful
Build and push / Pulling repo on server (push) Successful in 3s
All checks were successful
Build and push / Pulling repo on server (push) Successful in 3s
This commit is contained in:
@ -19,9 +19,14 @@ class Runs extends Page {
|
||||
$t = new Tournament();
|
||||
$t->load($run->data['tournament']);
|
||||
|
||||
$res = new Result();
|
||||
$results = $res->getDataOfRun($rid);
|
||||
|
||||
|
||||
$this->set('admin',$t->amIAdmin());
|
||||
$this->set('tournament', $t->data);
|
||||
$this->set('tournament_id', $run->data['tournament']);
|
||||
$this->set('results', $results);
|
||||
$this->set('run', $run->data);
|
||||
$this->set('run_id', $rid);
|
||||
$this->set('template', 'run.html');
|
||||
@ -49,7 +54,7 @@ class Runs extends Page {
|
||||
}
|
||||
}
|
||||
|
||||
function validateResults()
|
||||
function validateresults()
|
||||
{
|
||||
$rid = $_REQUEST['run_id'];
|
||||
$run = new Run();
|
||||
@ -74,12 +79,45 @@ class Runs extends Page {
|
||||
return partial('error.html', ['errorMessage' => 'Du bist in diesem Turnier nicht angemeldet']);
|
||||
else
|
||||
{
|
||||
$run->data['results']['time'] = $_REQUEST['time'];
|
||||
$run->data['results']['penalty'] = $_REQUEST['penalty'];
|
||||
$run->data['results']['disq'] = $_REQUEST['disq'];
|
||||
$run->data['results']['comment'] = $_REQUEST['comment'];
|
||||
$run->data['results']['referee'] = $_REQUEST['referee'];
|
||||
$run->data['results']['judge'] = $_REQUEST['judge'];
|
||||
$dogid = $_REQUEST['dog'];
|
||||
if(!$dogid || $dogid=='false')
|
||||
return partial('error.html', ['errorMessage' => 'Du musst einen Hund auswählen']);
|
||||
$dog = new Dog();
|
||||
if(!$dog->exists($dogid))
|
||||
return partial('error.html', ['errorMessage' => 'Dieser Hund existiert nicht']);
|
||||
else if(!$dog->isMyDog($dogid))
|
||||
return partial('error.html', ['errorMessage' => 'Dieser Hund gehört nicht dir']);
|
||||
|
||||
$res->dog = $dogid;
|
||||
$res->disqualified = $_REQUEST['disqualified'];
|
||||
$res->refusals = $_REQUEST['refusals'];
|
||||
$res->timefaults = $_REQUEST['time_faults'];
|
||||
$res->runtime = $_REQUEST['time'];
|
||||
$res->penalties = $_REQUEST['penalties'];
|
||||
$res->speed = $_REQUEST['time_speed'];
|
||||
$res->rating = $_REQUEST['bewertung'];
|
||||
$res->points = $_REQUEST['points'];
|
||||
$res->ranking = $_REQUEST['rank'];
|
||||
$res->public = $_REQUEST['public'];
|
||||
$res->tournament = $tid;
|
||||
$res->run = $rid;
|
||||
$res->user = $_SESSION['user']->id;
|
||||
|
||||
try{
|
||||
$resid = $res->save();
|
||||
|
||||
if(!in_array($resid, $run->data['results']))
|
||||
{
|
||||
$run->data['results'][] = $resid;
|
||||
$run->save();
|
||||
}
|
||||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
return partial('error.html', ['errorMessage' => 'Fehler beim Speichern des Ergebnisses: '.$e->getMessage()]);
|
||||
}
|
||||
|
||||
$this->redirect('/runs/overview/'.$rid);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user