baptisteArno / typebot.io

💬 Typebot is a powerful chatbot builder that you can self-host.
https://typebot.io
Other
7.17k stars 1.96k forks source link

Moment of the Day Conditional Branch Always Defaults to Else #1666

Closed ZimaBlueee closed 2 months ago

ZimaBlueee commented 2 months ago

Hi,

图片

As shown in the attached image, I've followed the documentation to set up the Moment of the Day, but the conditional branch always defaults to the Else branch, no matter how many times I try.

图片

On the result page, the Moment variable has a value.

Could you please help me resolve this issue?

Thank you!

baptisteArno commented 2 months ago

Hey,

Can you clearly describe it by following this template:

  1. Steps to reproduce
  2. What's happening
  3. What were you expecting

It's even better if you can provide a screen recording.

This ultimately allow me to reproduce the bug so that I can fix it properly.

ZimaBlueee commented 2 months ago

@baptisteArno Hi

Steps to reproduce:

  1. Set a variable using Moment of the Day as per the documentation.
  2. The documentation states that the variable can only have one of the four possible values: morning, afternoon, evening, or night.
  3. Use an if statement to check for all four possible values.

What's happening:

No matter how I test the variable, the execution always goes to the else branch, which shouldn't be the case.

What were you expecting:

I expected that the if statements would correctly match one of the four defined values (morning, afternoon, evening, night) and not fall into the else branch.

baptisteArno commented 2 months ago

I can't reproduce:

CleanShot 2024-07-29 at 14 00 50@2x

ZimaBlueee commented 2 months ago

hi,@baptisteArno

image

I know how to reproduce it. If there are multiple conditions, it will go wrong, but if there is only one condition, it is fine!

baptisteArno commented 2 months ago

Your second condition is missing an operator.

Here is an example with multi comparison: Moment typebot export.json

ZimaBlueee commented 2 months ago

@baptisteArno

I found the reason for my error! If there is an extra blank condition in the if condition, it will not work properly!

Is this a bug? Or is it normal?

image

baptisteArno commented 2 months ago

You are adding a comparison that will always return false since it is empty. So it is expected.