Add count error ans queue in info view

This commit is contained in:
Knah Tsaeb 2023-06-29 10:08:37 +02:00
parent 89a5f95b71
commit 5197923e3b
3 changed files with 31 additions and 7 deletions

View File

@ -91,7 +91,8 @@ class Backend {
$conx = new DataBase();
$genList = $conx->getList($this->start, $this->end);
$total = $conx->getTotal();
$inError = $conx->getInError();
$inQueue = $this->getInQueue();
$start = $this->start;
$max = $this->max;
$next = $start + $max;
@ -206,6 +207,15 @@ class Backend {
return (object)$newConfig->all();
}
private function getInQueue() {
if (glob(__DIR__ . '/../../cache/queue/*.json') != false) {
$fileCount = count(glob(__DIR__ . '/../../cache/queue/*.json'));
} else {
$fileCount = 0;
}
return $fileCount;
}
private function showLogin() {
ob_start();
$token = Page::genToken();

View File

@ -119,7 +119,21 @@ class DataBase {
}
public function getTotal() {
$stmt = $this->db->prepare("SELECT COUNT(id) AS nb FROM soshot ");
$stmt = $this->db->prepare("SELECT COUNT(id) AS nb FROM soshot;");
$stmt->execute();
$result = $stmt->fetch();
return $result['nb'];
}
public function getInError() {
$stmt = $this->db->prepare("SELECT COUNT(DISTINCT id) AS nb FROM soshot WHERE
complete = 2 OR
full = 2 OR
hd = 2 OR
thumb = 2 OR
fav = 2 OR
og = 2 OR
pdf = 2;");
$stmt->execute();
$result = $stmt->fetch();
return $result['nb'];

View File

@ -8,9 +8,11 @@ use App\Utils\Domains;
<div class="w3-row soshot-main w3-margin-bottom">
<div class="w3-container">
<h1 class="w3-text-teal">Infos</h1>
<p>
Nb : <?= $total; ?>
</p>
<ul>
<li>Total : <?= $total; ?></li>
<li>Queue : <?= $inQueue; ?></li>
<li>Error : <?= $inError; ?></li>
</ul>
<table class="w3-table-all w3-hoverable">
<thead>
<tr>
@ -133,5 +135,3 @@ use App\Utils\Domains;
}
}
</script>
<?php
//require_once 'footer.php';