From 7a000fb820b77c100359491dbef87b8a028f42cd Mon Sep 17 00:00:00 2001 From: Pavel Shevaev Date: Thu, 16 Nov 2023 13:13:17 +0300 Subject: [PATCH] Showing basic plans info in session title --- session.inc.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/session.inc.php b/session.inc.php index 0cb663a..77ea9f5 100644 --- a/session.inc.php +++ b/session.inc.php @@ -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) {