diff --git a/bots/models.py b/bots/models.py
index e2c66148a..3a440ab73 100644
--- a/bots/models.py
+++ b/bots/models.py
@@ -935,10 +935,7 @@ def to_df_format(
else None
), # only show first feedback as per Sean's request
"Analysis JSON": message.analysis_result,
- "Response Time": (
- message.response_time
- and round(message.response_time.total_seconds(), 1)
- ),
+ "Run Time": message.saved_run.run_time if message.saved_run else 0, # user messages have no run/run_time
}
rows.append(row)
df = pd.DataFrame.from_records(
@@ -950,7 +947,7 @@ def to_df_format(
"Sent",
"Feedback",
"Analysis JSON",
- "Response Time",
+ "Run Time",
],
)
return df
diff --git a/recipes/VideoBotsStats.py b/recipes/VideoBotsStats.py
index 00c7f07dd..a8fd4e541 100644
--- a/recipes/VideoBotsStats.py
+++ b/recipes/VideoBotsStats.py
@@ -291,15 +291,16 @@ def render_date_view_inputs(self, bi):
start_date = bi.created_at
end_date = timezone.now()
else:
- start_of_year_date = timezone.now().replace(month=1, day=1)
+ fifteen_days_ago = timezone.now() - timedelta(days=15)
+ fifteen_days_ago = fifteen_days_ago.replace(hour=0, minute=0, second=0)
st.session_state.setdefault(
"start_date",
self.request.query_params.get(
- "start_date", start_of_year_date.strftime("%Y-%m-%d")
+ "start_date", fifteen_days_ago.strftime("%Y-%m-%d")
),
)
start_date: datetime = (
- st.date_input("Start date", key="start_date") or start_of_year_date
+ st.date_input("Start date", key="start_date") or fifteen_days_ago
)
st.session_state.setdefault(
"end_date",
@@ -311,7 +312,7 @@ def render_date_view_inputs(self, bi):
st.date_input("End date", key="end_date") or timezone.now()
)
st.session_state.setdefault(
- "view", self.request.query_params.get("view", "Weekly")
+ "view", self.request.query_params.get("view", "Daily")
)
st.write("---")
view = st.horizontal_radio(
@@ -439,8 +440,6 @@ def calculate_stats_binned_by_time(
)
)
.annotate(Average_runtime=Avg("saved_run__run_time"))
- .annotate(Average_response_time=Avg("response_time"))
- .annotate(Average_analysis_time=Avg("analysis_run__run_time"))
.annotate(Unique_feedback_givers=Count("feedbacks", distinct=True))
.values(
"date",
@@ -448,9 +447,7 @@ def calculate_stats_binned_by_time(
"Convos",
"Senders",
"Unique_feedback_givers",
- "Average_response_time",
"Average_runtime",
- "Average_analysis_time",
)
)
@@ -504,9 +501,7 @@ def calculate_stats_binned_by_time(
"Convos",
"Senders",
"Unique_feedback_givers",
- "Average_response_time",
"Average_runtime",
- "Average_analysis_time",
],
)
df = df.merge(
@@ -546,11 +541,6 @@ def calculate_stats_binned_by_time(
) * 100
df["Msgs_per_convo"] = df["Messages_Sent"] / df["Convos"]
df["Msgs_per_user"] = df["Messages_Sent"] / df["Senders"]
- try:
- df["Average_response_time"] = df["Average_response_time"].dt.total_seconds()
- except AttributeError:
- pass
- df["Average_response_time"] = df["Average_response_time"] * factor
df.fillna(0, inplace=True)
df = df.round(0).astype("int32", errors="ignore")
return df
@@ -699,14 +689,6 @@ def plot_graphs(self, view, df):
st.write("---")
fig = go.Figure(
data=[
- go.Scatter(
- name="Average Response Time",
- mode="lines+markers",
- x=list(df["date"]),
- y=list(df["Average_response_time"]),
- text=list(df["Average_response_time"]),
- hovertemplate="Average Response Time: %{y:.0f}",
- ),
go.Scatter(
name="Average Run Time",
mode="lines+markers",
@@ -715,14 +697,6 @@ def plot_graphs(self, view, df):
text=list(df["Average_runtime"]),
hovertemplate="Average Runtime: %{y:.0f}",
),
- go.Scatter(
- name="Average Analysis Time",
- mode="lines+markers",
- x=list(df["date"]),
- y=list(df["Average_analysis_time"]),
- text=list(df["Average_analysis_time"]),
- hovertemplate="Average Analysis Time: %{y:.0f}",
- ),
],
layout=dict(
margin=dict(l=0, r=0, t=28, b=0),