Merge branch 'dev' into hugo-shipping-notice
This commit is contained in:
commit
ca32191c77
30 files changed
+1181
-79
No files matched your search
@@ -1320,6 +1320,8 @@ def _apply_chat_logs_report_filters(query):
|
||||
query = query.filter(Agent.name.cast(db.String).ilike(f'%{value}%'))
|
||||
elif key == 'username':
|
||||
query = query.filter(User.username.cast(db.String).ilike(f'%{value}%'))
|
||||
elif key == 'real_name':
|
||||
query = query.filter(User.real_name.cast(db.String).ilike(f'%{value}%'))
|
||||
elif hasattr(ChatLog, key):
|
||||
col = getattr(ChatLog, key)
|
||||
query = query.filter(col.cast(db.String).ilike(f'%{value}%'))
|
||||
@@ -1391,6 +1393,11 @@ def get_table_count(table):
|
||||
"""
|
||||
Return total row count for admin report tables.
|
||||
"""
|
||||
if table == 'chat_logs':
|
||||
query = _apply_chat_logs_report_filters(_chat_logs_report_query())
|
||||
total = query.count()
|
||||
return jsonify({'table': table, 'total': int(total or 0)})
|
||||
|
||||
model_map = {'users': User, 'agents': Agent, 'chat_logs': ChatLog, 'feedbacks': Feedback, 'permission_requests': PermissionRequest, 'departments': Department, 'quick_questions': QuickQuestion, 'user_homepage_configs': UserHomepageConfig, 'user_favorite_agents': UserFavoriteAgent, 'user_default_agents': UserDefaultAgent}
|
||||
model = model_map.get(table)
|
||||
if not model:
|
||||
|
||||
Reference in new issue
Block a user