Showing basic plans info in session title

This commit is contained in:
Pavel Shevaev 2023-11-16 13:13:17 +03:00
parent f3dae81643
commit 7a000fb820
1 changed files with 11 additions and 1 deletions

View File

@ -93,7 +93,8 @@ class Session
function getTitle() : string
{
return "Session ({$this->id}) '{$this->name}' (devices:".sizeof($this->getDevices())." ?:".sizeof($this->ignored_devices) .
$finished_plans = $this->countFinishedPlans();
return "Session ({$this->id}) '{$this->name}' (plans:$finished_plans/".sizeof($this->plans)." devices:".sizeof($this->getDevices())." ?:".sizeof($this->ignored_devices) .
') (' . round($this->getDuration()/60, 1) . ' min)';
}
@ -367,6 +368,15 @@ class Session
return true;
}
function countFinishedPlans() : int
{
$n = 0;
foreach($this->plans as $plan)
if(!$plan->isOver())
$n++;
return $n;
}
function trySendStatsFromJzonAsync(Task $task, string $jzon) : Amp\Promise
{
return Amp\call(function() use($task, $jzon) {