feat(api): sessions search default sort
feat(api): funnels ignore empty values feat(api): sessions search ignore empty values feat(api): saved search return filter feat(api): saved search return empty filter
This commit is contained in:
parent
64351ffe40
commit
dff39cee65
5 changed files with 10 additions and 2 deletions
|
|
@ -77,6 +77,8 @@ def get_all(project_id, user_id, details=False):
|
|||
for row in rows:
|
||||
row["createdAt"] = TimeUTC.datetime_to_timestamp(row["createdAt"])
|
||||
if details:
|
||||
if isinstance(row["filter"], list) and len(row["filter"]) == 0:
|
||||
row["filter"] = {}
|
||||
row["filter"] = helper.old_search_payload_to_flat(row["filter"])
|
||||
return rows
|
||||
|
||||
|
|
|
|||
|
|
@ -297,6 +297,8 @@ def search_query_parts(data, error_status, errors_only, favorite_only, issue, pr
|
|||
op = __get_sql_operator(f.operator) \
|
||||
if filter_type not in [schemas.FilterType.events_count] else f.operator
|
||||
is_any = _isAny_opreator(f.operator)
|
||||
if not is_any and len(f.value) == 0:
|
||||
continue
|
||||
is_not = False
|
||||
if __is_negation_operator(f.operator):
|
||||
is_not = True
|
||||
|
|
@ -445,6 +447,8 @@ def search_query_parts(data, error_status, errors_only, favorite_only, issue, pr
|
|||
is_any = _isAny_opreator(event.operator)
|
||||
if not isinstance(event.value, list):
|
||||
event.value = [event.value]
|
||||
if not is_any and len(event.value) == 0:
|
||||
continue
|
||||
op = __get_sql_operator(event.operator)
|
||||
is_not = False
|
||||
if __is_negation_operator(event.operator):
|
||||
|
|
|
|||
|
|
@ -130,6 +130,8 @@ def get_stages_and_events(filter_d, project_id) -> List[RealDictRow]:
|
|||
if not isinstance(s["value"], list):
|
||||
s["value"] = [s["value"]]
|
||||
is_any = sessions._isAny_opreator(s["operator"])
|
||||
if not is_any and isinstance(s["value"], list) and len(s["value"]) == 0:
|
||||
continue
|
||||
op = sessions.__get_sql_operator(s["operator"])
|
||||
event_type = s["type"].upper()
|
||||
if event_type == events.event_type.CLICK.ui_type:
|
||||
|
|
|
|||
|
|
@ -1124,7 +1124,7 @@ def add_saved_search(projectId: int, data: schemas.SavedSearchSchema = Body(...)
|
|||
|
||||
@app.get('/{projectId}/saved_search', tags=["savedSearch"])
|
||||
def get_saved_searches(projectId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": saved_search.get_all(project_id=projectId, user_id=context.user_id)}
|
||||
return {"data": saved_search.get_all(project_id=projectId, user_id=context.user_id, details=True)}
|
||||
|
||||
|
||||
@app.get('/{projectId}/saved_search/{search_id}', tags=["savedSearch"])
|
||||
|
|
|
|||
|
|
@ -536,7 +536,7 @@ class SessionsSearchPayloadSchema(BaseModel):
|
|||
# rangeValue:str=Field(...)
|
||||
startDate: int = Field(None)
|
||||
endDate: int = Field(None)
|
||||
sort: str = Field(...)
|
||||
sort: str = Field(default="startTs")
|
||||
order: str = Field(default="DESC")
|
||||
# platform: Optional[PlatformType] = Field(None)
|
||||
events_order: Optional[SearchEventOrder] = Field(default=SearchEventOrder._then)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue