Fix calculate_attendance_status missing return result, move chart imports to top

This commit is contained in:
IT狗
2026-07-21 11:03:21 +08:00
parent 02b4a49e8c
commit 0b58a1c05a
2 changed files with 2 additions and 1 deletions
+1
View File
@@ -309,6 +309,7 @@ def calculate_attendance_status(check_in, check_out, shift_start, shift_end):
result["status_text"] = " / ".join(status_parts) if status_parts else "正常" result["status_text"] = " / ".join(status_parts) if status_parts else "正常"
return result
@app.get("/api/attendance/lateness") @app.get("/api/attendance/lateness")
async def get_lateness_stats(current_user: User = Depends(get_current_user)): async def get_lateness_stats(current_user: User = Depends(get_current_user)):
"""Calculate full attendance statistics: late, early, OT""" """Calculate full attendance statistics: late, early, OT"""
+1 -1
View File
@@ -2,6 +2,7 @@ import { useState, useEffect } from 'react'
import { Link } from 'react-router-dom' import { Link } from 'react-router-dom'
import api from '../api' import api from '../api'
import { Users, AlertTriangle, FileSpreadsheet, RefreshCw, TrendingUp, MapPin, Clock, AlertCircle, FileCode } from 'lucide-react' import { Users, AlertTriangle, FileSpreadsheet, RefreshCw, TrendingUp, MapPin, Clock, AlertCircle, FileCode } from 'lucide-react'
import { BarChart, Bar, XAxis, YAxis, CartesianGrid, Tooltip, ResponsiveContainer, PieChart, Pie, Cell, LineChart, Line } from 'recharts'
const handleExportHTML = (section) => { const handleExportHTML = (section) => {
const token = localStorage.getItem('aars_token') const token = localStorage.getItem('aars_token')
@@ -9,7 +10,6 @@ const handleExportHTML = (section) => {
window.open(`/api/report/${section}/html?token=${token}`, '_blank') window.open(`/api/report/${section}/html?token=${token}`, '_blank')
} }
} }
import { BarChart, Bar, XAxis, YAxis, CartesianGrid, Tooltip, ResponsiveContainer, PieChart, Pie, Cell, LineChart, Line } from 'recharts'
const COLORS = ['#3b82f6', '#ef4444', '#22c55e', '#f59e0b', '#8b5cf6', '#ec4899', '#06b6d4', '#84cc16'] const COLORS = ['#3b82f6', '#ef4444', '#22c55e', '#f59e0b', '#8b5cf6', '#ec4899', '#06b6d4', '#84cc16']