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}")
result = {
"total": total,
"new": new_requests,
"in_progress": in_progress,
"completed": completed,
"rejected": rejected
"total_requests": total,
"by_status": {
"new": new_requests,
"in_progress": in_progress,
"completed": completed,
"rejected": rejected
}
}
request_logger.info(f"Returning statistics: {result}")

View File

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