Skip to content

Commit bf78bce

Browse files
authored
Admin queries (#173)
* Admin queries * As query option * PR comments * Changed order
1 parent 680fcde commit bf78bce

File tree

4 files changed

+736
-1
lines changed

4 files changed

+736
-1
lines changed

business_objects/user.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,8 @@ def get_active_users_after_filter(
177177
if last_interaction_range:
178178
query += f"\nAND last_interaction >= '{last_interaction_range}'"
179179
if sort_key:
180+
if sort_key == "organization":
181+
sort_key = "organization_name"
180182
sort_direction = "DESC" if sort_direction == -1 else "ASC"
181183
query += f"\nORDER BY {sort_key} {sort_direction}"
182184
if offset:

enums.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -871,3 +871,17 @@ class EvaluationRunState(Enum):
871871
RUNNING = "RUNNING"
872872
SUCCESS = "SUCCESS"
873873
FAILED = "FAILED"
874+
875+
876+
class AdminQueries(Enum):
877+
# default values for parameters can be found in file admin_queries.py
878+
USERS_TO_PROJECTS = "USERS_TO_PROJECTS" # parameter options: organization_id
879+
ACTIVE_USERS_GLOBAL = "ACTIVE_USERS_GLOBAL" # parameter options: min_msg_count, period (days, weeks or months), slices, organization_id
880+
ACTIVE_USERS_BY_ORG = "ACTIVE_USERS_BY_ORG" # parameter options: min_msg_count, period (days, weeks or months), slices, organization_id
881+
MESSAGES_CREATED = "MESSAGES_CREATED" # parameter options: period (days, weeks or months), slices, organization_id
882+
MESSAGES_CREATED_BY_PROJECT = "MESSAGES_CREATED_BY_PROJECT" # parameter options: period (days, weeks or months), slices, organization_id
883+
MESSAGES_FEEDBACK_PER_PROJECT = "MESSAGES_FEEDBACK_PER_PROJECT" # parameter options: period (days, weeks or months), slices, organization_id
884+
AVG_MESSAGES_PER_CONVERSATION_GLOBAL = (
885+
"AVG_MESSAGES_PER_CONVERSATION_GLOBAL" # parameter options: organization_id
886+
)
887+
AVG_MESSAGES_PER_CONVERSATION = "AVG_MESSAGES_PER_CONVERSATION" # parameter options: period (days, weeks or months), slices, organization_id

0 commit comments

Comments
 (0)