dog overview
All checks were successful
Build and push / Pulling repo on server (push) Successful in 3s

This commit is contained in:
2023-10-31 21:43:08 +00:00
parent af05f1d520
commit 7b79995796
5 changed files with 82 additions and 3 deletions

View File

@ -15,6 +15,39 @@ class Dog extends Model
'active' => ['type' => 'bool', 'default' => 1]
);
function getResults($dogid=false)
{
if(!$dogid)
$dogid = $this->id;
$res = new Result();
$keys = $GLOBALS['redis']->keys($res->getTable() . ':*');
$results = [];
foreach ($keys as $key) {
$id = end(explode(':', $key));
$res = new Result();
$res->load($id);
if ($res->data['dog'] == $dogid) {
$results[] = $res->data;
}
}
return $results;
}
function getRuns()
{
$run = new Run();
$keys = $GLOBALS['redis']->keys($run->dbTable . ':*');
$runs = [];
foreach ($keys as $key) {
$id = end(explode(':', $key));
$run = new Run();
$run->load($id);
if ($run->data['dog'] == $this->id)
$runs[] = $run->data;
}
return $runs;
}
function isMyDog($dog = false)
{
if ($dog == false)