Skip to content

Commit

Permalink
make response_time null by default
Browse files Browse the repository at this point in the history
  • Loading branch information
devxpy committed Feb 5, 2024
1 parent d2da2d1 commit b063439
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 21 deletions.
19 changes: 0 additions & 19 deletions bots/migrations/0056_message_response_time.py

This file was deleted.

23 changes: 23 additions & 0 deletions bots/migrations/0057_message_response_time_and_more.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 4.2.7 on 2024-02-05 15:11

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('bots', '0056_botintegration_streaming_enabled'),
]

operations = [
migrations.AddField(
model_name='message',
name='response_time',
field=models.DurationField(default=None, help_text='The time it took for the bot to respond to the corresponding user message', null=True),
),
migrations.AlterField(
model_name='botintegration',
name='streaming_enabled',
field=models.BooleanField(default=False, help_text='If set, the bot will stream messages to the frontend (Slack only)'),
),
]
8 changes: 6 additions & 2 deletions bots/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -932,7 +932,10 @@ def to_df_format(
else None
), # only show first feedback as per Sean's request
"Analysis JSON": message.analysis_result,
"Response Time": round(message.response_time.total_seconds(), 1),
"Response Time": (
message.response_time
and round(message.response_time.total_seconds(), 1)
),
}
rows.append(row)
df = pd.DataFrame.from_records(
Expand Down Expand Up @@ -1054,7 +1057,8 @@ class Message(models.Model):
)

response_time = models.DurationField(
default=datetime.timedelta(seconds=-1),
default=None,
null=True,
help_text="The time it took for the bot to respond to the corresponding user message",
)

Expand Down

0 comments on commit b063439

Please sign in to comment.