17 lines
546 B
Python
17 lines
546 B
Python
from flask import current_app
|
|
from app.models import LeaveRecord, Student
|
|
from flask_login import current_user
|
|
|
|
def get_pending_leaves_count():
|
|
"""获取待审批请假数量"""
|
|
try:
|
|
return LeaveRecord.query.filter_by(status='待审批').count()
|
|
except:
|
|
return 0
|
|
|
|
def get_current_student():
|
|
"""获取当前登录用户的学生信息"""
|
|
if current_user.is_authenticated and not current_user.is_admin():
|
|
return Student.query.filter_by(student_number=current_user.student_number).first()
|
|
return None
|