Refresh the complete row on all overview pages on changes, including the background color (closes #39)

This commit is contained in:
Bernd Bestel
2018-08-07 20:11:08 +02:00
parent 339d81318f
commit c4b0ef4d49
10 changed files with 176 additions and 49 deletions

View File

@@ -20,11 +20,13 @@ class BatteriesService extends BaseService
$battery = $this->Database->batteries($batteryId);
$batteryChargeCylcesCount = $this->Database->battery_charge_cycles()->where('battery_id', $batteryId)->count();
$batteryLastChargedTime = $this->Database->battery_charge_cycles()->where('battery_id', $batteryId)->max('tracked_time');
$nextChargeTime = $this->Database->batteries_current()->where('battery_id', $batteryId)->min('next_estimated_charge_time');
return array(
'battery' => $battery,
'last_charged' => $batteryLastChargedTime,
'charge_cycles_count' => $batteryChargeCylcesCount
'charge_cycles_count' => $batteryChargeCylcesCount,
'next_estimated_charge_time' => $nextChargeTime
);
}

View File

@@ -23,6 +23,7 @@ class HabitsService extends BaseService
$habit = $this->Database->habits($habitId);
$habitTrackedCount = $this->Database->habits_log()->where('habit_id', $habitId)->count();
$habitLastTrackedTime = $this->Database->habits_log()->where('habit_id', $habitId)->max('tracked_time');
$nextExeuctionTime = $this->Database->habits_current()->where('habit_id', $habitId)->min('next_estimated_execution_time');
$lastHabitLogRow = $this->Database->habits_log()->where('habit_id = :1 AND tracked_time = :2', $habitId, $habitLastTrackedTime)->fetch();
$lastDoneByUser = null;
@@ -37,7 +38,8 @@ class HabitsService extends BaseService
'habit' => $habit,
'last_tracked' => $habitLastTrackedTime,
'tracked_count' => $habitTrackedCount,
'last_done_by' => $lastDoneByUser
'last_done_by' => $lastDoneByUser,
'next_estimated_execution_time' => $nextExeuctionTime
);
}

View File

@@ -37,6 +37,7 @@ class StockService extends BaseService
$productStockAmount = $this->Database->stock()->where('product_id', $productId)->sum('amount');
$productLastPurchased = $this->Database->stock_log()->where('product_id', $productId)->where('transaction_type', self::TRANSACTION_TYPE_PURCHASE)->max('purchased_date');
$productLastUsed = $this->Database->stock_log()->where('product_id', $productId)->where('transaction_type', self::TRANSACTION_TYPE_CONSUME)->max('used_date');
$nextBestBeforeDate = $this->Database->stock()->where('product_id', $productId)->min('best_before_date');
$quPurchase = $this->Database->quantity_units($product->qu_id_purchase);
$quStock = $this->Database->quantity_units($product->qu_id_stock);
@@ -54,7 +55,8 @@ class StockService extends BaseService
'stock_amount' => $productStockAmount,
'quantity_unit_purchase' => $quPurchase,
'quantity_unit_stock' => $quStock,
'last_price' => $lastPrice
'last_price' => $lastPrice,
'next_best_before_date' => $nextBestBeforeDate
);
}