Skip to content

Commit

Permalink
Simplify convert_page for v1.6 and remove unused functions in agent_c…
Browse files Browse the repository at this point in the history
…hecker_util
  • Loading branch information
SeanScripts committed Feb 9, 2023
1 parent 25b613d commit 1e97000
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 42 deletions.
12 changes: 2 additions & 10 deletions src/dfcx_scrapi/core/test_cases.py
Original file line number Diff line number Diff line change
Expand Up @@ -446,22 +446,14 @@ def _convert_flow(self, flow_id, flows_map):
# Note that flow id includes agent, normally...
def _convert_page(self, page_id, flow_id, pages_map):
"""Gets a page display name from a page and flow ID"""
special_page_dict = {
"END_SESSION": "End Session",
"END_FLOW": "End Flow",
"START_PAGE": "Start"
}
if page_id in special_page_dict:
return special_page_dict[page_id]

page_id_converted = str(flow_id) + "/pages/" + str(page_id)
if flow_id in pages_map:
# page_id is sometimes left empty for the test case if it starts
# on the start page
return pages_map[flow_id].get(page_id_converted, "Start")
return pages_map[flow_id].get(page_id_converted, "START_PAGE")
logging.info(f"Flow not found: {flow_id}")
# TODO: Should throw error, but returning this probably will anyway
return "Invalid"
return "INVALID"

def get_test_case_results_df(self, agent_id=None, retest_all=False):
"""Gets the test case results for this agent,
Expand Down
32 changes: 0 additions & 32 deletions src/dfcx_scrapi/tools/agent_checker_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,38 +174,6 @@ def _get_all_route_group_data(self, delay):
time.sleep(delay)
return route_group_data

# Conversion utilities
# (Not currently used)

def _convert_intent(self, intent_id):
"""Gets an intent display name from an intent ID"""
intent_id_converted = str(self.agent_id) + "/intents/" + str(intent_id)
return self._intents_map.get(intent_id_converted, "")

def _convert_flow(self, flow_id):
"""Gets a flow display name from a flow ID"""
if flow_id.split("/")[-1] == "-":
return ""
# flow_id_converted = str(agent_id) + '/flows/' + str(flow_id)
return self._flows_map.get(flow_id, "Default Start Flow")
# TODO: Should throw error instead of returning default

# Note that flow id includes agent, normally...
def _convert_page(self, page_id, flow_id):
"""Gets a page display name from a page and flow ID"""
if page_id == "END_SESSION":
return "End Session"
elif page_id == "END_FLOW":
return "End Flow"
elif page_id == "START_PAGE":
return "Start"
page_id_converted = str(flow_id) + "/pages/" + str(page_id)
if flow_id in self._pages_map:
return self._pages_map[flow_id].get(page_id_converted, "Start")
logging.info("Flow not found")
# TODO: Should throw error, but returning this probably will anyway
return "Invalid"

def _get_intent_parameters(self, intent_name):
"""Gets the parameters for a particular intent, by display name"""
for intent in self._intent_data:
Expand Down

0 comments on commit 1e97000

Please sign in to comment.