diff --git a/web/inc/classes/Model.class.php b/web/inc/classes/Model.class.php
index 31f70f1..330e0af 100644
--- a/web/inc/classes/Model.class.php
+++ b/web/inc/classes/Model.class.php
@@ -65,13 +65,10 @@ class Model {
{
if(isset($this->data[$field]))
{
- error_log($field.' -> '.$options['type']);
if($options['type']=='array')
$GLOBALS['redis']->hset($this->dbTable.':'.$this->id,$field,json_encode($this->data[$field]));
else
{
-
- error_log("hset $this->dbTable:$this->id $field {$this->data[$field]}");
$GLOBALS['redis']->hset($this->dbTable.':'.$this->id,$field,$this->data[$field]);
}
}
@@ -85,7 +82,7 @@ class Model {
{
$this->id = $id;
if(!$GLOBALS['redis']->exists($this->dbTable.':'.$this->id))
- return false;
+ throw new Exception($this->dbTable.':'.$this->id.' not found');
$keys = array_keys($this->dbFields);
foreach($keys as $key)
diff --git a/web/models/Dog.model.php b/web/models/Dog.model.php
index 72a6643..96a0afe 100644
--- a/web/models/Dog.model.php
+++ b/web/models/Dog.model.php
@@ -9,8 +9,8 @@ class Dog extends Model {
'kennel_name' => ['type'=>'text'],
'breed' => ['type'=>'text'],
'size' => ['type'=>'text'], //in cm
- 'birthday' => ['type'=>'int'], //unix timestamp
- 'agility_size' => ['type'=>'int'], //S,M,I,L
+ 'birthday' => ['type'=>'text'],
+ 'agility_size' => ['type'=>'text'], //S,M,I,L
'active' => ['type'=>'int','default'=>1]
);
diff --git a/web/pages/dogs/controller.php b/web/pages/dogs/controller.php
index e3eedf5..a81f07f 100644
--- a/web/pages/dogs/controller.php
+++ b/web/pages/dogs/controller.php
@@ -19,14 +19,18 @@ class Dogs extends Page {
$dogs = $_SESSION['user']->data['dogs'];
$doggos = [];
- foreach($dogs as $dogid)
+ foreach($dogs as $key => $dogid)
{
+ //var_dump($dogid);
$dog = new Dog();
try{
$dog->load($dogid);
}
catch(Exception $e)
{
+ error_log("Dog $dogid not found. Deleting from user");
+ unset($_SESSION['user']->data['dogs'][$key]);
+ $_SESSION['user']->save();
continue;
}
if($dog->data)
diff --git a/web/pages/dogs/list.html b/web/pages/dogs/list.html
index 96bfe65..45a91f1 100644
--- a/web/pages/dogs/list.html
+++ b/web/pages/dogs/list.html
@@ -1,48 +1,43 @@
Meine Hunde
-
-
-
-
-
-
-
-
-
- = $key ?>
-
-
-
- Bearbeiten
-
-
- Löschen
-
-
-
-
-
+
+
+
+
+
+
+ = $key ?>
+
+
-
-
-
- = $dog[$key] ?>
-
-
+
+ Bearbeiten
+
+
+ Löschen
+
+
+
+
+
-
-
-
-
-
-
-
+
+
+
+ = $dog[$key] ?>
+
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/web/pages/home/home.html b/web/pages/home/home.html
index 83de1e4..56ed9ed 100644
--- a/web/pages/home/home.html
+++ b/web/pages/home/home.html
@@ -20,7 +20,7 @@