From 052f4ac035f135994347395bdb90bc2c1aa348fd Mon Sep 17 00:00:00 2001 From: Fred Tempez Date: Tue, 30 Jan 2024 18:51:19 +0100 Subject: [PATCH] =?UTF-8?q?1.4.16=20corrige=20les=20statistiques=20des=20p?= =?UTF-8?q?ages=20supprim=C3=A9es=20mais=20d=C3=A9j=C3=A0=20consult=C3=A9e?= =?UTF-8?q?s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- core/core.php | 2 +- core/module/course/course.php | 34 ++++++++++++++++++++-------------- 3 files changed, 22 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 5e3de41..86693a8 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# ZwiiCampus 1.4.15 +# ZwiiCampus 1.4.16 ZwiiCampus (Learning Management System) est logiciel auteur destiné à mettre en ligne des tutoriels. Il dispose de plusieurs modalités d'ouverture et d'accès des contenus. Basé sur la version 13 du CMS Zwii, la structure logicielle est solide, le framework de Zwii est éprouvé. diff --git a/core/core.php b/core/core.php index 70368ac..8691bf2 100644 --- a/core/core.php +++ b/core/core.php @@ -51,7 +51,7 @@ class common const ACCESS_TIMER = 1800; // Numéro de version - const ZWII_VERSION = '1.4.15'; + const ZWII_VERSION = '1.4.16'; // URL autoupdate const ZWII_UPDATE_URL = 'https://forge.chapril.org/ZwiiCMS-Team/campus-update/raw/branch/master/'; diff --git a/core/module/course/course.php b/core/module/course/course.php index c9759a9..0e94fb8 100644 --- a/core/module/course/course.php +++ b/core/module/course/course.php @@ -679,7 +679,7 @@ class course extends common $this->getData(['user', $userId, 'tags']), template::button('userHistory' . $userId, [ 'href' => helper::baseUrl() . 'course/userHistory/' . $courseId . '/' . $userId, - 'value' => !empty($userValue['history']) ? round(($viewPages * 100) / $sumPages, 1) . ' %' : '0%', + 'value' => !empty($userValue['history']) ? min(round(($viewPages * 100) / $sumPages, 1), 100) . ' %' : '0%', 'disable' => empty($userValue['history']) ]), template::button('userDelete' . $userId, [ @@ -1142,22 +1142,26 @@ class course extends common if (is_array($times)) { $d = array(); foreach ($times as $time) { + if (isset($pages[$pageId]['number'])) { + self::$userHistory[] = [ + $pages[$pageId]['number'], + html_entity_decode($pages[$pageId]['title']), + helper::dateUTF8('%d %B %Y %H:%M', $time) + ]; + $floorTime = isset($floorTime) && $floorTime < $time ? $floorTime : $time; + $topTime = isset($topTime) && $topTime > $time ? $topTime : $time; + } + } + } else { + if (isset($pages[$pageId]['number'])) { self::$userHistory[] = [ $pages[$pageId]['number'], html_entity_decode($pages[$pageId]['title']), - helper::dateUTF8('%d %B %Y %H:%M', $time) + helper::dateUTF8('%d %B %Y %H:%M', $times) ]; - $floorTime = isset($floorTime) && $floorTime < $time ? $floorTime : $time; - $topTime = isset($topTime) && $topTime > $time ? $topTime : $time; + $floorTime = isset($floorTime) && $floorTime < $times ? $floorTime : $times; + $topTime = isset($topTime) && $topTime > $times ? $topTime : $times; } - } else { - self::$userHistory[] = [ - $pages[$pageId]['number'], - html_entity_decode($pages[$pageId]['title']), - helper::dateUTF8('%d %B %Y %H:%M', $times) - ]; - $floorTime = isset($floorTime) && $floorTime < $times ? $floorTime : $times; - $topTime = isset($topTime) && $topTime > $times ? $topTime : $times; } } @@ -1243,10 +1247,12 @@ class course extends common $userId, $this->getData(['user', $userId, 'firstname']), $this->getData(['user', $userId, 'lastname']), - $pages[$this->getData(['enrolment', $courseId, $userId, 'lastPageView'])], + isset($pages[$this->getData(['enrolment', $courseId, $userId, 'lastPageView'])]) + ? $pages[$this->getData(['enrolment', $courseId, $userId, 'lastPageView'])] + : $this->getData(['enrolment', $courseId, $userId, 'lastPageView']) . ' (supprimée)', helper::dateUTF8('%d/%d/%Y', $this->getData(['enrolment', $courseId, $userId, 'datePageView'])), helper::dateUTF8('%H:%M', $this->getData(['enrolment', $courseId, $userId, 'datePageView'])), - number_format(round(($viewPages * 100) / $sumPages, 1) / 100, 2, ',') + number_format(min(round(($viewPages * 100) / $sumPages, 1) / 100, 1), 2, ',') ]; // Synthèse des historiques