1
0
mirror of https://gitlab.com/MoonTestUse1/AdministrationItDepartmens.git synced 2025-08-14 00:25:46 +02:00

починка админки1132222

This commit is contained in:
MoonTestUse1
2025-01-04 01:45:36 +06:00
parent b790073072
commit a5f3635434
2 changed files with 20 additions and 8 deletions

View File

@@ -23,11 +23,13 @@ def get_statistics(db: Session = Depends(get_db)):
request_logger.info(f"Status counts - new: {new_requests}, in_progress: {in_progress}, completed: {completed}, rejected: {rejected}") request_logger.info(f"Status counts - new: {new_requests}, in_progress: {in_progress}, completed: {completed}, rejected: {rejected}")
result = { result = {
"total": total, "total_requests": total,
"new": new_requests, "by_status": {
"in_progress": in_progress, "new": new_requests,
"completed": completed, "in_progress": in_progress,
"rejected": rejected "completed": completed,
"rejected": rejected
}
} }
request_logger.info(f"Returning statistics: {result}") request_logger.info(f"Returning statistics: {result}")

View File

@@ -25,6 +25,11 @@
<h3>Завершенные</h3> <h3>Завершенные</h3>
<p class="stat-number">{{ statistics.by_status?.completed || 0 }}</p> <p class="stat-number">{{ statistics.by_status?.completed || 0 }}</p>
</div> </div>
<div class="stat-card">
<h3>Отклоненные</h3>
<p class="stat-number">{{ statistics.by_status?.rejected || 0 }}</p>
</div>
</div> </div>
<div class="actions-grid"> <div class="actions-grid">
@@ -106,18 +111,23 @@ export default {
methods: { methods: {
async fetchStatistics() { async fetchStatistics() {
try { try {
const response = await axios.get('/api/requests/statistics', { const response = await axios.get('/api/statistics/', {
headers: { headers: {
Authorization: `Bearer ${localStorage.getItem('admin_token')}` Authorization: `Bearer ${localStorage.getItem('admin_token')}`
} }
}) })
this.statistics = response.data this.statistics = response.data
console.log('Полученная статистика:', response.data)
} catch (error) { } catch (error) {
console.error('Error fetching statistics:', error) console.error('Error fetching statistics:', error)
this.statistics = { this.statistics = {
total_requests: 0, total_requests: 0,
by_status: {}, by_status: {
by_priority: {} new: 0,
in_progress: 0,
completed: 0,
rejected: 0
}
} }
} }
}, },